Create a route from an assisiative array or stdClass object

@param Route|\stdClass|array $value
@return Route
185638
protected function createRoute($value)
    {
        if ($value instanceof Route) {
            return $value;
        }
        
        if (is_array($value)) {
            $value = (object)$value;
        }
        
        if (is_object($value) && is_callable($value)) {
            $value = (object)['fn' => $value];
        }
        
        if (!$value instanceof \stdClass) {
            throw new \InvalidArgumentException("Unable to create a Route from value " . var_export($value, true));
        }
        
        return new Route($value);
    }
1010326
public function setValue($value) : parent
    {
        if (!is_array($value)) {
            $value = [$value];
        }

        foreach ($value as $current) {
            if (!$current instanceof \Cawa\Http\File && !is_null($current)) {
                throw new \LogicException(sprintf(
                    "File '%s' value must be an instance of \\Cawa\\Http\\File, '%s' given",
                    $this->getName(),
                    is_object($current) ? get_class($current) : gettype($current)
                ));
            }
        }

        $this->value = $value;

        return $this;
    }
118532
private function getDataFromRoute(Route $route, $value)
    {
        if ($route->getRequirement('id') !== null &&
            $route->getMethods() === ['GET'] &&
            preg_match($route->compile()->getRegex(), $value, $matches)
        ) {
            $id = $matches['id'];

            list($routeService) = explode(':', $route->getDefault('_controller'));
            list($core, $bundle,,$name) = explode('.', $routeService);
            $serviceName = implode('.', [$core, $bundle, 'rest', $name]);
            $collection = array_search($serviceName, $this->mapping);

            return [$collection, $id];
        }

        return [null, null];
    }
870384
public function add($value): AbstractArray
    {
        $value = $this->filterValue($value);
        if (is_null($value)) {
            return $this;
        }

        if (!in_array($value, $this->values)) {
            array_push($this->values, $value);
        }

        $this->atomics['$addToSet']['$each'][] = $value;

        return $this;
    }
502223
public static function make($value)
    {
        if (is_resource($value)) {
            $value = null;
        } elseif (Arr::accessible($value)) {
            $value = new ArraySerialization($value);
        } elseif ($value instanceof stdClass) {
            $value = new ObjectSerialization($value);
        } elseif ($value instanceof Container) {
            $value = new ContainerSerialization($value);
        } elseif ($value instanceof DateTime) {
            $value = new DateTimeSerialization($value);
        } elseif ($value instanceof Validator) {
            $value = new ValidatorSerialization($value);
        } elseif ($value instanceof Throwable) {
            $value = new ThrowableSerialization($value);
        } elseif ($value instanceof Closure) {
            $value = null;
        }

        return $value;
    }
808991
public static function first($value)
    {

        if (is_array($value) && $value) {
            reset($value);
            return current($value);
        }

        if (!$value) {
            return null;
        }

        if (is_string($value)) {
            return $value[0];
        }

        if (!is_object($value)) {
            return null;
        }

        if ($value instanceof ArrayAccess && isset($value[0])) {
            return $value[0];
        }

        if (!$value instanceof Traversable) {
            return null;
        }

        foreach ($value as $key=>$item) {
            return $item;
        }

        return null;

    }
303897
public static function isTraversable($value)
    {
        return is_array($value) || (is_object($value) &&  (get_class($value) == 'stdClass' || $value instanceof \Traversable));
    }
1095287
private function makeSerializable($value)
    {
        if (null === $value) {
            return $value;
        }

        if ($value instanceof Traversable || is_array($value)) {
            $value = ArrayUtils::iteratorToArray($value);

            foreach ($value as $key => $val) {
                $value[$key] = $this->makeSerializable($val);
            }

            return $value;
        }

        if (is_scalar($value)) {
            return $value;
        }

        if (is_resource($value)) {
            return 'resource';
        }

        return new ObjectStub($value);
    }
72935
public function serialize($value)
    {
        $this->noMappingGuard();

        //LEGACY ARRAY SERIALIZATION
        if (\is_array($value) && !empty($value[Serializer::MAP_TYPE])) {
            $data = $this->legacySerializeArray($value);

            return $this->outputStrategy($data);
        }

        //HAL PAGINATION SERIALIZATION
        if (!empty($value[Serializer::CLASS_IDENTIFIER_KEY])) {
            if ($value[Serializer::CLASS_IDENTIFIER_KEY] === HalPagination::class) {
                foreach ($value[self::EMBEDDED_KEY][Serializer::SCALAR_VALUE] as $k => $v) {
                    $value[self::EMBEDDED_KEY][Serializer::SCALAR_VALUE][$k] = $this->serializeObject($v);
                }
            }
        }

        //HAL SERIALIZATION
        $data = $this->serializeObject($value);

        return $this->outputStrategy($data);
    }
22523
protected function link($value, array $options)
    {
        $return = is_string($value) ? $value : (is_array($value) ? implode(',', $value) : $value);

        if ($options['link']) {
            return sprintf('<a href="%s">%s</a>', $options['link'], $return);
        }

        if ($options['route']) {
            $url = $this->generator->generate($options['route'], $options['parameters'] ?? []);

            return sprintf('<a href="%s">%s</a>', $url, $return);
        }

        return $return;
    }
1029919
public static function fromArray(array $value)
    {
        $language = null;
        $culture = null;

        if (!empty($value['language'])) {
            $language = $value['language'];
        } elseif ($value[0]) {
            $language = $value[0];
        }

        if (!empty($value['culture'])) {
            $culture = $value['culture'];
        } elseif ($value[1]) {
            $culture = $value[1];
        }

        return new static($language, $culture);
    }
775144
public function push($value): AbstractArray
    {
        $value = $this->filterValue($value);
        if (is_null($value)) {
            return $this;
        }

        array_push($this->values, $value);
        $this->atomics['$push']['$each'][] = $value;

        return $this;
    }
976542
public function extract($value)
    {
        if (is_null($value)) {
            return $value;
        }

        $entityValues = $this->getHydratorForEntity($value)->extract($value);
        $entityMetadata = $this->getMetadataMap()[ClassUtils::getRealClass(get_class($value))];

        $link = new Link('self');
        $link->setRoute($entityMetadata['route_name']);
        $link->setRouteParams([
            $entityMetadata['route_identifier_name'] => $entityValues[$entityMetadata['entity_identifier_name']]
        ]);

        $linkCollection = new LinkCollection();
        $linkCollection->add($link);

        $halEntity = new HalEntity(new stdClass());
        $halEntity->setLinks($linkCollection);

        return $halEntity;
    }
107795
protected function _normalizeArray($value)
    {
        if ($value instanceof stdClass) {
            $value = (array) $value;
        }

        if (is_array($value)) {
            return $value;
        }

        if (!($value instanceof Traversable)) {
            throw $this->_createInvalidArgumentException($this->__('Not an iterable'), null, null, $value);
        }

        $value = iterator_to_array($value, true);

        return $value;
    }
1296429
protected function createItem($value) {
		$text="";
		$v=$value;
		if(\is_array($value)){
			$v=@$value[0];
			$text=@$value[1];
		}
		$count=\sizeof($this->content);
		$value=new HtmlIcon("icon-".$count, $v);
		$value->wrap("",$text);
		$itemO=new HtmlLink("item-".$count,"",$value);
		return $itemO->setClass("item");
	}
385325
protected function unserializeObject(array $value)
    {
        $className = $value[self::CLASS_IDENTIFIER_KEY];
        unset($value[self::CLASS_IDENTIFIER_KEY]);

        if (isset($value[self::MAP_TYPE])) {
            unset($value[self::MAP_TYPE]);
            unset($value[self::SCALAR_VALUE]);
        }

        if ($className[0] === '@') {
            return self::$objectMapping[substr($className, 1)];
        }

        if (!class_exists($className)) {
            throw new SerializerException('Unable to find class '.$className);
        }

        return (null === ($obj = $this->unserializeDateTimeFamilyObject($value, $className)))
            ? $this->unserializeUserDefinedObject($value, $className) : $obj;
    }
134887
public function setValue( $value )
    {
        if ( $value instanceof Traversable )
        {
            $value = ArrayUtils::iteratorToArray( $value );
        }

        return parent::setValue( (array) $value );
    }