@param object $entry

@return ORMInvalidArgumentException
767730
public static function newEntityFoundThroughRelationship(AssociationMetadata $association, $entry)
    {
        $message = "A new entity was found through the relationship '%s#%s' that was not configured to cascade "
            . 'persist operations for entity: %s. To solve this issue: Either explicitly call EntityManager#persist() '
            . 'on this unknown entity or configure cascade persist this association in the mapping for example '
            . '@ManyToOne(..,cascade={"persist"}).%s';

        $messageAppend = method_exists($entry, '__toString')
            ? ''
            : " If you cannot find out which entity causes the problem implement '%s#__toString()' to get a clue.";

        return new self(sprintf(
            $message,
            $association->getSourceEntity(),
            $association->getName(),
            self::objToStr($entry),
            sprintf($messageAppend, $association->getTargetEntity())
        ));
    }
982739
public function get($entry)
    {
        $value = false;

        foreach ($this->caches as $cache) {
            $value = $cache->get($entry);
            if ($value !== false) {
                return $value;
            }
        }
        return $value;
    }
259313
protected function parse($object)
    {
        if (! is_object($object)) {
            throw new ValidationException(
                'Error has to be an object, "' . gettype($object) . '" given.'
            );
        }

        if (property_exists($object, 'id')) {
            if (! is_string($object->id)) {
                throw new ValidationException(
                    'property "id" has to be a string, "' .
                    gettype($object->id) . '" given.'
                );
            }

            $this->set('id', strval($object->id));
        }

        if (property_exists($object, 'links')) {
            $this->set('links', $this->create('ErrorLink', $object->links));
        }

        if (property_exists($object, 'status')) {
            if (! is_string($object->status)) {
                throw new ValidationException(
                    'property "status" has to be a string, "' .
                    gettype($object->status) . '" given.'
                );
            }

            $this->set('status', strval($object->status));
        }

        if (property_exists($object, 'code')) {
            if (! is_string($object->code)) {
                throw new ValidationException(
                    'property "code" has to be a string, "' .
                    gettype($object->code) . '" given.'
                );
            }

            $this->set('code', strval($object->code));
        }

        if (property_exists($object, 'title')) {
            if (! is_string($object->title)) {
                throw new ValidationException(
                    'property "title" has to be a string, "' .
                    gettype($object->title) . '" given.'
                );
            }

            $this->set('title', strval($object->title));
        }

        if (property_exists($object, 'detail')) {
            if (! is_string($object->detail)) {
                throw new ValidationException(
                    'property "detail" has to be a string, "' .
                    gettype($object->detail) . '" given.'
                );
            }

            $this->set('detail', strval($object->detail));
        }

        if (property_exists($object, 'source')) {
            $this->set('source', $this->create('ErrorSource', $object->source));
        }

        if (property_exists($object, 'meta')) {
            $this->set('meta', $this->create('Meta', $object->meta));
        }
    }
1259978
public function addEntry($entry)
	{
		// Set some default field values if not already set.
		$date = new AnDate();

		if (!isset ($entry['date'])) {
			$entry['date'] = $date->format("%Y-%m-%d");
		}

		if (!isset ($entry['time'])) {
			$entry['time'] = $date->format("%H:%M:%S");
		}

		if (!isset ($entry['c-ip'])) {
			$entry['c-ip'] = $_SERVER['REMOTE_ADDR'];
		}

		// Ensure that the log entry keys are all uppercase
		$entry = array_change_key_case($entry, CASE_UPPER);

		// Find all fields in the format string
		$fields = array ();
		$regex = "/{(.*?)}/i";
		preg_match_all($regex, $this->_format, $fields);

		// Fill in the field data
		$line = $this->_format;

		for ($i = 0; $i < count($fields[0]); $i++) {
			$line = str_replace($fields[0][$i], (isset ($entry[$fields[1][$i]])) ? $entry[$fields[1][$i]] : "-", $line);
		}

		// Write the log entry line
		if ($this->_openLog()) {
            return fputs($this->_file, "\n" . $line) ? true : false;
		}

        return false;
	}
90069
protected function addLogEntry(LogEntry $entry)
	{
		// Find all the appropriate loggers based on priority and category for the entry.
		$loggers = $this->findLoggers($entry->priority, $entry->category);

		foreach ((array) $loggers as $signature)
		{
			// Attempt to instantiate the logger object if it doesn't already exist.
			if (empty($this->loggers[$signature]))
			{
				$class = '\\Joomla\\Log\\Logger\\' . ucfirst($this->configurations[$signature]['logger']);

				if (class_exists($class))
				{
					$this->loggers[$signature] = new $class($this->configurations[$signature]);
				}
				else
				{
					throw new \RuntimeException('Unable to create a Joomla\\Log\\AbstractLogger instance: ' . $class);
				}
			}

			// Add the entry to the logger.
			$this->loggers[$signature]->addEntry(clone($entry));
		}
	}
582504
public function parse(&$entry)
    {
        foreach ($this->types as $type => $attr) {
            // initialize map type to entry
            $type_var          = '_' . $attr;
            $this->{$type_var} = array();

            // get values for this type
            if ($entry->exists($attr)) {
                $values = $entry->getValue($attr);
                if (is_array($values)) {
                    foreach ($values as $value) {

                        unset($schema_entry); // this was a real mess without it

                        // get the schema entry
                        $schema_entry = $this->_parse_entry($value);

                        // set the type
                        $schema_entry['type'] = $type;

                        // save a ref in $_oids
                        $this->_oids[$schema_entry['oid']] = &$schema_entry;

                        // save refs for all names in type map
                        $names = $schema_entry['aliases'];
                        array_push($names, $schema_entry['name']);
                        foreach ($names as $name) {
                            $this->{$type_var}[strtolower($name)] = &$schema_entry;
                        }
                    }
                }
            }
        }
        $this->_initialized = true;
    }
1105133
public function orx($value)
    {
        if(!is_array($value)) {
            // get arguments 
            $value = func_get_args();
        }
        // Convert all values to 
        $conds = array_map(function($v) {
                if(is_string($v) && $this->getQueryParser()) {
                    return $this->getQueryParser()->parseExpression($v);
                } else if(!$v instanceof Expr\ConditionalExpression) {
                    throw new \InvalidArgumentException('');
                } 
                return $v;
            }, $value);

        //return new Expr\OrX($conds);
        return new Expr\LogicalExpression($conds, Expr\LogicalExpression::TYPE_OR);
    }
434103
public function getSectionOfEntry( $entry )
	{
		foreach( $this->getSections() as $section )
			if( in_array( $entry, $this->list[$section] ) )
				return $section;
		throw new InvalidArgumentException( 'Entry "'.$entry.'" not found in any Section.' );
	}
1084923
protected function validateAliasEntry($entry)
    {
        if (!is_string($entry)) {
            $type = is_object($entry) ? get_class($entry) : gettype($entry);
            $message = sprintf('Argument "entry" in "%s" must be a string; "%s" was given.', __METHOD__, $type);
            throw new Exception\InvalidArgumentException($message);
        }

        if (!$this->has($entry)) {
            throw new Exception\NotFoundException($entry);
        }
    }
672451
public function add($entry)
    {
        $this->log[] = $entry;
        while (count($this->log) > $this->size) {
            array_shift($this->log);
        }
    }
481691
protected function _createItem( array $entry )
	{
		$item = $this->_manager->createItem();

		foreach( $entry as $name => $value )
		{
			switch( $name )
			{
				case 'cache.id': $item->setId( $value ); break;
				case 'cache.value': $item->setValue( $value ); break;
				case 'cache.tags': $item->setTags( (array) $value ); break;
				case 'cache.expire':
					if( $value != '' )
					{
						$value = str_replace( 'T', ' ', $value );
						$entry->{'cache.expire'} = $value;
						$item->setTimeExpire( $value );
					}
					break;
			}
		}

		return $item;
	}
695793
protected function parse($object)
    {
        if (! is_object($object)) {
            throw new ValidationException('Resource has to be an object, "' . gettype($object) . '" given.');
        }

        if (! property_exists($object, 'type')) {
            throw new ValidationException('A resource object MUST contain a type');
        }

        if (! property_exists($object, 'id')) {
            throw new ValidationException('A resource object MUST contain an id');
        }

        if (is_object($object->type) or is_array($object->type)) {
            throw new ValidationException('Resource type cannot be an array or object');
        }

        if (is_object($object->id) or is_array($object->id)) {
            throw new ValidationException('Resource Id cannot be an array or object');
        }

        $this->set('type', strval($object->type));
        $this->set('id', strval($object->id));

        if (property_exists($object, 'meta')) {
            $this->set('meta', $this->create('Meta', $object->meta));
        }
    }
1295460
private function prepareEntriesToDeliver(array $entries)
    {
        $binaryAttributes = ['objectguid', 'objectsid'];

        foreach ($entries as $key => &$entry) {
            foreach ($binaryAttributes as $binaryAttribute) {
                if (array_key_exists($binaryAttribute, $entry)) {
                    if (is_array($entry[$binaryAttribute])) {
                        foreach ($entry[$binaryAttribute] as &$value) {
                            $value = bin2hex($value);
                        }
                    } else {
                        $entry[$binaryAttribute] = bin2hex($entry[$binaryAttribute]);
                    }
                }
            }
        }

        return $entries;
    }
436355
public function prePersist($object)
    {
        /** @var ContentInterface $contentObject */
        if ($contentObject = $object->getContent()) {
            try {
                $this->getModelManager()->create($contentObject);
                $object->setObjectId($contentObject->getId());
                $this->autoPageDraft($object->getPage());
            } catch (ModelManagerException $e) {
                throw new ModelManagerException($this->trans('Cannot create content, object is invalid', [], 'validators'));
            }
        }
    }
218697
public function nestedValidate($value) : NestableResult
    {
        $outer = parent::validateSimple($value);

        // Fatal error => no inner validation.
        $schema = $outer->isFatal() ? [] : $this->schema;
        $values = [];

        // Regrettably, as neat as I could get it...
        foreach ($schema as $key => $validator) {
            if (!isset($value[$key])) {
                $values[$key] = Result::failure('missing key');

                if ($validator instanceof NestableAbstract) {
                    $values[$key] = NestableResult::lift($values[$key]);
                }
            } else {
                $values[$key] = $validator instanceof NestableAbstract
                    ? $validator->nestedValidate($value[$key])
                    : $validator->validate($value[$key]);
            }
        }

        return new NestableResult($outer, $values);
    }
242669
public function validateObject($object) {
        if (!$object instanceof SerialisableObject) {
            throw new ClassNotSerialisableException(get_class($object));
        }

        $classAnnotations = ClassAnnotationParser::instance()->parse($object);

        $validationFields = $classAnnotations->getFieldAnnotationsForMatchingTag("validation");

        $validationErrors = array();

        foreach ($validationFields as $field => $annotation) {

            $value = $object->__getSerialisablePropertyValue($field);

            foreach ($annotation[0]->getValues() as $validatorString) {

                $explodedValidator = explode("(", $validatorString);
                $validatorKey = trim($explodedValidator[0]);

                // Gather validator args if supplied.
                $validatorArgs = array();
                if (sizeof($explodedValidator) > 1) {
                    $argsCSV = explode(")", $explodedValidator[1]);
                    $args = explode("|", $argsCSV[0]);

                    foreach ($args as $arg) {
                        $validatorArgs[] = trim($arg);
                    }
                }

                $validator = isset($this->validators[$validatorKey]) ? $this->validators[$validatorKey] : null;
                if (isset($validator)) {
                    $valid = $validator->validateObjectFieldValue($value, $field, $object, $validatorArgs, $validatorKey);

                    if ($valid !== true) {
                        if (!isset($validationErrors[$field])) $validationErrors[$field] = array();
                        $message = preg_replace_callback("/\\$([0-9])/", function ($matches) use ($validatorArgs) {
                            return $validatorArgs[$matches[1] - 1];
                        }, $validator->getValidationMessage());
                        $validationErrors[$field][$validatorKey] = new FieldValidationError($field, $validatorKey, $message);
                    }

                } else {
                    throw new InvalidValidatorException($validatorKey, $field, $object);
                }


            }

        }

        return $validationErrors;


    }
83852
public function convertMapEntry(ProtoBuf\MapEntry $entry)
    {
        $field = $entry->getField();
        $type  = $field->getType();

        if ($type === MapFieldType::MAP) {
            return $this->fromProtoBuf($entry->map_value);
        }

        if ($type === MapFieldType::SET) {
            return $entry->set_value;
        }

        if ($type === MapFieldType::FLAG) {
            return ($entry->flag_value == ProtoBuf\MapUpdate\FlagOp::ENABLE);
        }

        if ($type === MapFieldType::COUNTER) {
            return $entry->counter_value;
        }

        if ($type === MapFieldType::REGISTER) {
            return $entry->register_value;
        }

        throw new InvalidArgumentException(sprintf('Unknown crdt field type : %s', $type));
    }