Wire::__debugInfo PHP Method

__debugInfo() public method

This is used when you print_r() an object instance.
public __debugInfo ( ) : array
return array
    public function __debugInfo()
    {
        static $debugInfo = null;
        if (is_null($debugInfo)) {
            $debugInfo = new WireDebugInfo();
        }
        return $debugInfo->getDebugInfo($this);
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * debugInfo PHP 5.6+ magic method
  *
  * @return array
  *
  */
 public function __debugInfo()
 {
     $info = parent::__debugInfo();
     $info['count'] = $this->count();
     if (count($this->data)) {
         $info['items'] = array();
         foreach ($this->data as $key => $value) {
             if (is_object($value)) {
                 if (method_exists($value, 'path')) {
                     $value = '/' . ltrim($value->path(), '/');
                 } else {
                     if ($value instanceof WireData) {
                         $_value = $value;
                         $value = $value->name;
                         if (!$value) {
                             $value = $_value->id;
                         }
                         if (!$value) {
                             $value = $_value->className();
                         }
                     } else {
                         // keep $value as it is
                     }
                 }
             }
             $info['items'][$key] = $value;
         }
     }
     if (count($this->extraData)) {
         $info['extraData'] = $this->extraData;
     }
     if (count($this->itemsAdded)) {
         $info['itemsAdded'] = $this->itemsAdded;
     }
     if (count($this->itemsRemoved)) {
         $info['itemsRemoved'] = $this->itemsRemoved;
     }
     return $info;
 }
All Usage Examples Of Wire::__debugInfo