@param                  $value
@param PropertyContract $meta

@return array|bool|mixed|string
@throws Exception
350041
private function ___attForeign($value, $meta)
    {

        if (!$value) {
            return false;
        }

        $value = count(
            array_filter(
                array_keys($value),
                'is_string'
            )
        ) > 0 ? [$value] : $value;

        $aInstance = [];
        foreach ($value as $item) {

            $class = $meta->getComposition()->getClass();

            if (!$item || !is_array($item)) {
                $msg = "Tentativa de atribuição de dependência [ {$meta->getAlias()} ] com valor não array.";

                throw new Exception($msg, 400);
            }

            $instance = call_user_func_array([$class, 'make'], [$item]);

            if ($meta->getType() === 'json') {
                $instance->withNotNull();

                $instance = $instance->toArray(true);
            }

            $aInstance[] = $instance;
        }

        $aInstance = count($aInstance) === 1 ? $aInstance[0] : $aInstance;

        if ($meta->getType() === 'json') {
            $aInstance = json_encode($aInstance);
        }

        return $aInstance;
    }
651225
public function withAddedMetadata(string $key, $value): ProophMessage
    {
        $copy = clone $this;
        $copy->metadata[$key] = $value;

        return $copy;
    }
367815
public function deleteMeta($key, $value = false)
    {
        if ($value) {
            $meta = $this->getMeta($key, null, true);

            if ($meta == null) {
                return false;
            }

            $obj = $this->getEditableItem($meta, $value);

            return $obj !== false ? $obj->delete() : false;

        } else {
            return $this->meta()->where('key', $key)->delete();
        }
    }
837781
protected function getPropertyValueFromObject(ClassMetadata $meta, $propertyName, $object)
    {
        $refl = $meta->getReflectionClass();
        $prop = $refl->getProperty($propertyName);
        $prop->setAccessible(true);
        $value = $prop->getValue($object);
        return $value;
    }
1258358
public byte[] toBinary(Object value, Object meta, boolean insertMeta) {
		return toBinary(value, meta, insertMeta, (input) -> {
			return mapper.writeValueAsBytes(input);
		}
528624
public function getSourceMeta($property)
    {
        $value = get_post_meta($this->invoiceSource->getId(), $property, true);
        // get_post_meta() can return false or ''.
        if (empty($value)) {
            // Not found: indicate so by returning null.
            $value = null;
        }
        return $value;
    }
692131
public function setMeta($key, $value = null)
    {
        if (is_array($key) && is_null($value)) {
            $this->meta = $key;
        } else {
            array_set($this->meta, $key, $value);
        }

        return $this;
    }
1260027
static public function string($value, $message = null, $propertyPath = null)
        {
            if ( ! is_string($value)) {
                $message = $message ?: sprintf(
                    'Value "%s" expected to be string, type %s given.',
                    static::stringify($value),
                    gettype($value)
                );

                throw static::createException($value, $message, static::INVALID_STRING, $propertyPath);
            }
        }
1100025
private function getValues($value)
    {
        if (is_array($value)) {
            $newValue = [];

            foreach ($value as $itemValue) {
                $newValue = array_merge($newValue, $this->getValues($itemValue));
            }

            return [$newValue];
        }

        $metadataFactory = $this->em->getMetadataFactory();
        $unitOfWork      = $this->em->getUnitOfWork();

        if (is_object($value) && $metadataFactory->hasMetadataFor(StaticClassNameConverter::getClass($value))) {
            $class     = $metadataFactory->getMetadataFor(get_class($value));
            $persister = $unitOfWork->getEntityPersister($class->getClassName());

            if ($class->isIdentifierComposite()) {
                $newValue = [];

                foreach ($persister->getIdentifier($value) as $innerValue) {
                    $newValue = array_merge($newValue, $this->getValues($innerValue));
                }

                return $newValue;
            }
        }

        return [$this->getIndividualValue($value)];
    }
1340754
public function addMeta($key, $value)
    {
        $meta = call_user_func_array("{$this->metaModel}::firstOrNew", [['key' => $key, $this->getMetaForeignKey() => $this->getKey()]]);
        $meta->value = $value;

        return $this->meta()->save($meta);
    }
671424
protected function getValueByAnnotatedType(ReflectionProperty $property, $value)
    {
        $comment = $property->getDocComment();
        if (preg_match('/@var (.+?)(\|null)? /', $comment, $matches)) {
            switch ($matches[1]) {
                case 'integer':
                case 'int':
                    $value = (int) $value;
                    break;
                case 'float':
                    $value = (float) $value;
                    break;
            }
        }

        return $value;
    }
700419
static public function boolean($value, $message = null, $propertyPath = null)
        {
            if ( ! is_bool($value)) {
                $message = $message ?: sprintf(
                    'Value "%s" is not a boolean.',
                    static::stringify($value)
                );

                throw static::createException($value, $message, static::INVALID_BOOLEAN, $propertyPath);
            }
        }
1263658
protected function setMetadata($metadata, $value = null)
	{
		if ( ! is_array($metadata))
		{
			$metadata = [(string) $metadata => $value];
		}
		
		$this->metadata = array_filter($metadata, 'is_scalar');
		
		return $this;
	}
384646
protected function validate(PropertyMetadata $metadata, string $name, & $value)
	{
		if (!$metadata->isValid($value)) {
			$class = get_class($this);
			throw new InvalidArgumentException("Value for {$class}::\${$name} property is invalid.");
		}
	}
809456
public function valid(EntityContract $entity, $value)
    {
        try {
            $value = Yaml::parse($value);
        } catch (ParseException $exception) {
            return false;
        }

        return true;
    }
1008555
static public function subclassOf($value, $className, $message = null, $propertyPath = null)
        {
            if (!is_subclass_of($value, $className)) {
                $message = $message ?: sprintf(
                    'Class "%s" was expected to be subclass of "%s".',
                    static::stringify($value),
                    $className
                );

                throw static::createException($value, $message, static::INVALID_SUBCLASS_OF, $propertyPath, array('class' => $className));
            }
        }
483310
protected function getPropertyData(PropertyMetadata $property, $propertyValue)
    {
        return $this->createProperty(
            $property->getName(),
            $this->exportManager->export($property->getType(), $propertyValue),
            $this->exportManager->getOptions($property->getType(), $this->format),
            $property->getType()
        );
    }