Jarves\Configuration\Model::toArray PHP Method

toArray() public method

public toArray ( boolean $printDefaults = false ) : array
$printDefaults boolean
return array
    public function toArray($printDefaults = false)
    {
        $result = array();
        $reflection = new \ReflectionClass($this);
        $blacklist = array('config', 'element', 'jarves', 'rootName', 'docBlock', 'docBlocks');
        foreach ($reflection->getProperties() as $property) {
            $k = $property->getName();
            if ($property->isPrivate()) {
                continue;
            }
            if (in_array($k, $blacklist)) {
                continue;
            }
            $value = $this->propertyToArray($k, $printDefaults);
            if (null === $value) {
                continue;
            }
            $result[$k] = $value;
        }
        return $result;
    }

Usage Example

Example #1
0
 /**
  * {@inheritdoc}
  */
 public function toArray($printDefaults = false)
 {
     $array = parent::toArray($printDefaults);
     $array['key'] = $this->getKey();
     return $array;
 }
All Usage Examples Of Jarves\Configuration\Model::toArray