@param $property
@param $obj

@return Pessoa
@throws \Exception
15299
public static function addPessoa(&$property, $obj)
    {
        if (is_subclass_of($obj, 'Eduardokum\\LaravelBoleto\\Contracts\\Pessoa')) {
            $property = $obj;
            return $obj;
        } elseif (is_array($obj)) {
            $obj = new Pessoa($obj);
            $property = $obj;
            return $obj;
        }
        throw new \Exception('Objeto inválido, somente Pessoa e Array');
    }
1303401
public function get($property) {
		if ($this->isProperty($property)) {
			return $this->properties[$property]->value();
		} else {
      throw new Exception("la propriété '".$property."' est invalide pour l'objet '".get_class($this)."'", '00010004');
		}
	}
1218363
private function readPrivateProperty($object, string $property)
    {
        $reflectionClass = new \ReflectionClass($object);
        $reflectionProperty = null;
        do {
            if ($reflectionClass->hasProperty($property)) {
                $reflectionProperty = $reflectionClass->getProperty($property);
            }
            $reflectionClass = $reflectionClass->getParentClass();
        } while ($reflectionClass);

        if ($reflectionProperty === null) {
            throw new \InvalidArgumentException("Unable to find property '".$property.'" in object of class '.get_class($object).". Please check your @URL annotation.");
        }

        $reflectionProperty->setAccessible(true);
        return $reflectionProperty->getValue($object);
    }
451881
public function add(Property $property)
    {
        $name = $property->getName();

        if (isset($this->elements[$name])) {
            throw new \Exception("Property with name '{$name}' already exists");
        }

        $this->elements[$name] = $property;

        return $this;
    }
718002
public function unsub($obj)
    {
        $this->detach($obj);
        if ($this->count() === 0) {
            if (($func = $this->deactCb) !== null) {
                $func($this);
            }
        }
        return $this;
    }
68656
private function getReflectionProperty($object, $property)
    {
        if (isset($this->properties[$key = $this->getCacheKey($object, $property)])) {
            return $this->properties[$key];
        }

        $reflection = new \ReflectionProperty($object, $property);
        $reflection->setAccessible(true);

        return $this->properties[$key] = $reflection;
    }
142223
public static function setPropertiesByObject($obj, $properties, $prefix) {
		$pSetter = new ReflectionUtils($obj);
		return $pSetter->setProperties($properties, $prefix);
	}
1093139
public static function createGetterFromProperty(PropertyInterface $property)
    {
        $method = new self();
        $method->setName('get_' . $property->getName());
        $method->setCode('return $this->' . $property->getName() . ';');

        return $method;
    }
677809
public static function objectToArray($OBJ)
    {
        if (is_object($OBJ)) {
            // Gets the properties of the given object with get_object_vars function
            $OBJ = get_object_vars($OBJ);
        }
        if (is_array($OBJ)) {
            // Return array converted to object using __FUNCTION__ (Magic constant) for recursive call in THIS object class type
            return array_map([get_called_class(), __FUNCTION__], $OBJ);
        }

        return $OBJ;
    }
1075984
public static function getProperties($obj)
    {
        $properties = array();
        try {
            $rc = new ReflectionClass($obj);
            do {
                $rp = array();

                // Note that we will not include any properties in traits
                $traits = $rc->getTraits();
                $skipProperties = array();
                if (!empty($traits)) {
                    foreach ($traits as $trait) {
                        foreach ($trait->getProperties() as $traitProperty) {
                            $skipProperties[] = $traitProperty->getName();
                        }
                    }
                }
                /* @var $p \ReflectionProperty */
                foreach ($rc->getProperties() as $p) {
                    if (in_array($p->getName(), $skipProperties, true)) {
                        continue;
                    }
                    $p->setAccessible(true);
                    $rp[$p->getName()] = $p->getValue($obj);
                }
                $properties = array_merge($rp, $properties);
            } while ($rc = $rc->getParentClass());
        } catch (ReflectionException $e) {
            //
        }
        return $properties;
    }
748352
public function delete($obj){
        $key  = $this->getModel()->table() . '_' . $obj->{$this->getModel()->getPK()->identifier()};
        $this->getDriver()->remove($key);

        return $this->getModel()->delete($obj);
    }
922393
public function objectToDom($obj)
    {
        $doc = new DomDocument('1.0', 'utf-8');

        foreach ($obj as $k => &$v) {
            $node = $this->objectToDomElement($v, $doc->createElement($k), $doc);
            break;
        }

        $doc->appendChild($node);

        return $doc;
    }
1243349
public static function setPropertyValue($obj,$propertyName,$value,$fieldAccess=false)
    {
        $setter=self::getSetter($obj, $propertyName);
        if(!empty($setter)){
            $obj->$setter($value);
        }else if($fieldAccess && property_exists($obj, $propertyName)){
            $obj->$propertyName=$value;
        }
    }
844198
public function injectDependency($property, $object)
    {
        if (!property_exists($this, $property)) {
            $this->raiseError("Injecting unknown property.");
        }
        $this->$property = $object;
        return $this;
    }
1273060
public static function getProperty(
        string $property,
        ?object $object,
        $defaultValue = null,
        ?string $classOverride = null
    ) {
        $reflectionClass = self::getReflectionClass($object, $classOverride);
        try {
            $property = $reflectionClass->getProperty($property);
            if ($object === null && !$property->isStatic()) {
                return $defaultValue;
            }
            $property->setAccessible(true);
            return $property->getValue($object);
        } catch (Exception $e) {
            return $defaultValue;
        }
    }
671983
public static function toPropertyValue($obj,$propertyName,$value)
    {
        if(property_exists($obj, $propertyName)){
            $obj->$propertyName=$value;
        }
    }
1031066
public static function create($object, $property)
    {
        $template = 'Property \'%s\' does not exist in instance of class \'%s\'. Did you use proper name of property?';
        $message = sprintf($template, $property, get_class($object));

        return new static($message);
    }