Example #1
0
 /**
  *	Получает информацию
  *
  *	@return	array
  */
 public function getContents()
 {
     if (!parent::getContents() or $this->previous_params && $this->previous_params != $this->request_params) {
         parent::__construct(call_user_func($this->closure, $this->request_params), true);
         $this->previous_params = $this->request_params;
     }
     return parent::getContents();
 }
Example #2
0
 /**
  *	Получает информацию о ресурсе
  *
  *	@return	mixed
  */
 public function getContents()
 {
     if (!parent::getContents() || $this->previous_params && $this->previous_params != $this->request_params) {
         $response = $this->request->get($this->parent_disk->getRequestUrl('resources', array_merge($this->request_params, array('path' => $this->resource_path))));
         $this->previous_params = $this->request_params;
         if (isset($response['type'])) {
             $this->resource_type = $response['type'];
         }
         if (isset($response['_embedded'], $response['_embedded']['items'])) {
             $response += ['items' => array_map(function ($item) {
                 return new self($item, $this->parent_disk, $this->request);
             }, $response['_embedded']['items'])] + $response['_embedded'];
         }
         unset($response['_links'], $response['_embedded']);
         parent::__construct($response);
     }
     return parent::getContents();
 }
 /**
  *	Есть такой ресурс или свойство
  *
  *	@param	string	$key	или NULL чтобы проверить ресурс
  *	@return	boolean
  */
 public function has($key = null)
 {
     try {
         if ($this->getContents()) {
             if ($key === null) {
                 return true;
             }
             return parent::has($key);
         }
     } catch (\Exception $exc) {
     }
     return false;
 }