Exemplo n.º 1
0
 /**
  * Apply the commonly used REST path members to the class.
  *
  * @param string $resourcePath
  *
  * @return $this
  */
 protected function setResourceMembers($resourcePath = null)
 {
     // File services need the trailing slash '/' for designating folders vs files
     // It is removed by the parent method
     $isFolder = empty($resourcePath) ? false : '/' === substr($resourcePath, -1);
     parent::setResourceMembers($resourcePath);
     if (!empty($resourcePath)) {
         if ($isFolder) {
             $this->folderPath = $resourcePath;
         } else {
             $this->folderPath = dirname($resourcePath) . '/';
             $this->filePath = $resourcePath;
         }
     }
     return $this;
 }
Exemplo n.º 2
0
 /**
  * Apply the commonly used REST path members to the class.
  *
  * @param string $resourcePath
  *
  * @return $this
  */
 protected function setResourceMembers($resourcePath = null)
 {
     parent::setResourceMembers($resourcePath);
     $this->resourceId = ArrayUtils::get($this->resourceArray, 1);
     $pos = 2;
     $more = ArrayUtils::get($this->resourceArray, $pos);
     if (!empty($more)) {
         if (SnsApplication::RESOURCE_NAME == $this->resource && SnsEndpoint::RESOURCE_NAME !== $more) {
             do {
                 $this->resourceId .= '/' . $more;
                 $pos++;
                 $more = ArrayUtils::get($this->resourceArray, $pos);
             } while (!empty($more) && SnsEndpoint::RESOURCE_NAME !== $more);
         } elseif (SnsEndpoint::RESOURCE_NAME == $this->resource) {
             //  This will be the full resource path
             do {
                 $this->resourceId .= '/' . $more;
                 $pos++;
                 $more = ArrayUtils::get($this->resourceArray, $pos);
             } while (!empty($more));
         }
     }
     $this->relatedResource = ArrayUtils::get($this->resourceArray, $pos++);
     $this->relatedResourceId = ArrayUtils::get($this->resourceArray, $pos++);
     $more = ArrayUtils::get($this->resourceArray, $pos);
     if (!empty($more) && SnsEndpoint::RESOURCE_NAME == $this->relatedResource) {
         do {
             $this->relatedResourceId .= '/' . $more;
             $pos++;
             $more = ArrayUtils::get($this->resourceArray, $pos);
         } while (!empty($more));
     }
     return $this;
 }