Robbo\Presenter\Decorator::decorate PHP Method

decorate() public method

* If this variable implements Robbo\Presenter\PresentableInterface then turn it into a presenter.
public decorate ( $value )
$value
    public function decorate($value)
    {
        if ($value instanceof PresentableInterface) {
            return $value->getPresenter();
        }
        if (is_array($value) or $value instanceof IteratorAggregate and $value instanceof ArrayAccess) {
            foreach ($value as $k => $v) {
                $value[$k] = $this->decorate($v);
            }
        }
        return $value;
    }

Usage Example

Beispiel #1
0
 /**
  * Get the value.
  *
  * @return string
  */
 public function getValue()
 {
     $object = $this->decorator->decorate($this->entry);
     if ($object instanceof FilePresenter) {
         return $object->readableSize();
     }
 }
All Usage Examples Of Robbo\Presenter\Decorator::decorate
Decorator