Ejemplo n.º 1
0
 /**
  * Room constructor.
  * @param $properties stdClass
  * @param $gitterApi GitterApi
  */
 public function __construct($properties, $gitterApi)
 {
     $this->gitterApi = $gitterApi;
     $existsProperties = ReflectionsContainer::getExistsProperties(Repository::class);
     foreach ($properties as $key => $property) {
         if ($key == 'room') {
             $this->room = new Room($property, $gitterApi);
             continue;
         }
         if (in_array($key, $existsProperties)) {
             $this->{$key} = $property;
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * User constructor.
  * @param $properties array
  * @param $gitterApi GitterApi
  */
 public function __construct($properties, $gitterApi)
 {
     $this->gitterApi = $gitterApi;
     $existsProperties = ReflectionsContainer::getExistsProperties(User::class);
     foreach ($properties as $key => $property) {
         if ($key == 'screenName') {
             $key = 'displayName';
         }
         if ($key == 'userId') {
             $key = 'id';
         }
         if (in_array($key, $existsProperties)) {
             $this->{$key} = $property;
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * Room constructor.
  * @param $properties stdClass
  * @param $gitterApi GitterApi
  * @param $room Room
  */
 public function __construct($properties, $gitterApi, $room)
 {
     $this->gitterApi = $gitterApi;
     $this->room = $room;
     $existsProperties = ReflectionsContainer::getExistsProperties(Message::class);
     foreach ($properties as $key => $property) {
         if ($key == 'fromUser') {
             $this->fromUser = new User($property, $gitterApi);
             continue;
         }
         if ($key == 'mentions' && count($property) > 0) {
             $this->mentions = collect([]);
             foreach ($property as $item) {
                 $this->mentions->push(new User($item, $gitterApi));
             }
             continue;
         }
         if (in_array($key, $existsProperties)) {
             $this->{$key} = $property;
         }
     }
 }