public static function castFrom(Model\MergeRequest $mr) { $cast = new static($mr->project, $mr->id, $mr->getClient()); foreach (static::$properties as $property) { $cast->{$property} = $mr->{$property}; } return $cast; }