lithium\util\Collection::append PHP Method

append() public method

Appends an item.
public append ( mixed $value )
$value mixed The item to append.
    public function append($value)
    {
        is_object($value) ? $this->_data[] =& $value : ($this->_data[] = $value);
    }

Usage Example

Example #1
0
 /**
  * List directory content
  *
  * @param string $path
  * @return boolean
  */
 public function ls($path = null)
 {
     $path = "{$this->_location}/{$path}";
     if (is_dir($path)) {
         $directory = new DirectoryIterator($path);
     } else {
         return false;
     }
     $collection = new Collection();
     foreach ($directory as $d) {
         if ($d->isDot()) {
             continue;
         }
         $url = rtrim($this->_config['url'], '/');
         $path = rtrim(substr($d->getPath(), strlen($this->_location)), '/') . '/';
         if ($url) {
             $url .= "{$path}{$d->getFilename()}";
         }
         $collection->append(new Entity(array('name' => $d->getFilename(), 'dir' => $d->isDir(), 'url' => $url, 'path' => $path, 'size' => $d->isDir() ? null : $d->getSize(), 'mode' => substr(sprintf('%o', $d->getPerms()), -4), 'adapter' => $this)));
     }
     return $collection;
 }
All Usage Examples Of lithium\util\Collection::append