jsonSpec = $jsonSpec; $this->type = $type; } static public function fromJson($jsonIdSpec) { if (! empty($jsonIdSpec) && in_array((string)$jsonIdSpec, idSpec::$types)) { $idSpecEnum = (string)$jsonIdSpec; } elseif (! empty($jsonIdSpec)) { $idSpecEnum = 'USER_IDS'; } else { throw new Exception("The json request had a bad idSpec"); } return new IdSpec($jsonIdSpec, $idSpecEnum); } /** * Only valid for IdSpecs of type USER_IDS * @return A list of the user ids in the id spec * */ public function fetchUserIds() { $userIdArray = $this->jsonSpec; if (! is_array($userIdArray)) { $userIdArray = array($userIdArray); } $userIds = array(); foreach ($userIdArray as $id) { $userIds[] = (string)$id; } return $userIds; } public function getType() { return $this->type; } }