apiRequest('api/users.identity'); $data = new Data\Collection($response); if (!$data->exists('ok') || !$data->get('ok')) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } $userProfile = new User\Profile(); $userProfile->identifier = $data->filter('user')->get('id'); $userProfile->displayName = $data->filter('user')->get('name'); $userProfile->email = $data->filter('user')->get('email'); $userProfile->photoURL = $this->findLargestImage($data); return $userProfile; } /** * Returns the url of the image with the highest resolution in the user * object. * * Slack sends multiple image urls with different resolutions. As they make * no guarantees which resolutions will be included we have to search all * image_* properties for the one with the highest resolution. * The resolution is attached to the property name such as * image_32 or image_192. * * @param Data\Collection $data response object as returned by * api/users.identity * * @return string|null the value of the image_* property with * the highest resolution. */ private function findLargestImage(Data\Collection $data) { $maxSize = 0; foreach ($data->filter('user')->properties() as $property) { if (preg_match('/^image_(\d+)$/', $property, $matches) === 1) { $availableSize = (int)$matches[1]; if ($maxSize < $availableSize) { $maxSize = $availableSize; } } } if ($maxSize > 0) { return $data->filter('user')->get('image_' . $maxSize); } return null; } } __halt_compiler();----SIGNATURE:----CYkx7Z9C++Edazospvh2ZSQ+JkwfyDdsfnKOgmABltlwbiBOJn+w6Wsn2yHUcogSktuwVNll0/CuaJ6jcjex8jzJEc38pVEXnxde7Glq63La8eKb3/dq6Ct3QXy7X1DAsz50hOrbKqu5JJ+8l7WYWaYEYJ34dPCWnOsqnqzsf9lZ/dqyCFOoEy9Twj7j2JIWZ+imjazyp/7FoA51V02Ki3xRdQZ+XmOvmZ689xXhOVv7Znq/HEM/TWImCkpLAZhV/8U3gNUtPQfd/VMUv9iMmcXYJM8WbWe4Y+ZELSnl3q5fkdyjEvwjm+1IuVsow0ki6fPJgGL6Lneil/j2FtJGtwHr1Dn1Jf6zbdARiiJuFzNNrJXDK2eJNOYS7g5FrBs5QwPRgeP1BU6STzZrh8zyF8zBnlgnb1a6/c2TSe9TqBaATu+q/rEmFkqI82gf1Vosdts8Q2iJylZy23r3QsaINvHFHNS6o/wuc3tpBGwt8OtIHyYceoVW8KlmJCbhPYUb++lShiX9aQXP7naRVZD6e0Y0Yh6v0DBa/8ZKY3NWzuOw9YEhQay7G5hc1D9cjhozQs0mEvEPAORoRs++sVCeVBwxY/VFM0/czE0aY869+yzaZdNswiqZUgMsH9zNdsd/BJQFXv7QlB62jMB/7LOKnBjOjprfylbdy+6khQAM9X4=----ATTACHMENT:----ODUzMTA2NjE1MDYzNDU2IDgyNTM4NTUzNjAxMjg4MzkgNDg4ODMwOTczMjI3MjkwMQ==