@throws \RuntimeException If search $hit could not be handled

@param mixed $hit

@return \eZ\Publish\API\Repository\Values\ValueObject
551986
public function extractHit($hit)
    {
        if ($hit->_type === 'content') {
            return $this->contentHandler->loadContentInfo($hit->_id);
        }

        if ($hit->_type === 'location') {
            return $this->locationHandler->load($hit->_id);
        }

        throw new RuntimeException(
            "Could not extract: document of type '{$hit->_type}' is not handled."
        );
    }
343107
public function hit($count = 1)
	{
		$hitsLeft = $this->memcached->get($this->key);
		if ($this->memcached->getResultCode() == Memcached::RES_NOTFOUND)
		{
			// this is the first hit
			$hitsLeft = $this->hits;
			$this->memcached->set($this->key, $this->hits, time() + $this->seconds);
		}

		if ($hitsLeft < $count)
		{
			return false;
		}

		if ($this->memcached->decrement($this->key, $count) === false)
		{
			// it failed to decrement
			return false;
		}

		return true;
	}
771298
public function hit($count = 1)
	{
		if (file_exists($this->path))
		{
			$expires = $this->getPathContent('expires');
			if ( ! is_null($expires))
			{
				$hits = $this->getPathContent('hits');
				$hits += $count;
				if ($hits > $this->hits)
				{
					// we reached the limit
					return false;
				}
				$size = $this->writePathContent($expires, $hits);

				return $size !== false;
			}
		}

		// first hit
		$expires = time() + $this->seconds;
		$size    = $this->writePathContent($expires, $count);

		return $size !== false;
	}
313542
public function setRuntime(string $runtime)
    {
        $this->runtime = $runtime;

        $this->hostConfig = array_merge($this->hostConfig, ['Runtime' => $runtime]);

        return $this;
    }
365922
private function preRequest(string $request): string
    {
        $result = $this->preRequest->handle(new TransportContainer($this, $request));

        if ($result instanceof TransportContainer) {
            return $result->getRequest();
        }

        throw new \RuntimeException();
    }
821624
public function setValueData($valueData)
    {
        $method = 'set'.ucfirst($this->getAttribute()->getType()->getDatabaseType());

        return $this->$method($valueData);
    }
1101168
public function offsetSet($name, $value)
    {
        $cookie = $this->_classes['cookie'];
        $value = $this->_autobox($name, $value);
        if (!$value instanceof $cookie) {
            throw new RuntimeException("Error, only `{$cookie}` instances are allowed in this collection.");
        }
        $hash = $name . ';' . $value->domain() . ';' . $value->path();
        $this->_hashes[$name][] = $hash;
        $this->_names[$hash] = $name;

        return $this->_data[$hash] = $value;
    }
1154832
public static function readProperty($object, $property, array $access)
    {
        if (AccessInfo::METHOD === $access['type']) {
            $value = $object->{$access['name']}();
        } elseif (AccessInfo::PROPERTY === $access['type']) {
            $value = $object->{$access['name']};
        } elseif (!$access['has_property'] && property_exists($object, $property)) {
            $value = $object->$property;
        } else {
            throw new \RuntimeException($access['name']);
        }

        return $value;
    }
690225
public function intersect(Value $set)
    {
        $intersect = $this->value;

        /** @var Value $arg */
        foreach (func_get_args() as $arg) {
            /** @var array $convertedArg */
            $convertedArg = $arg->getSet()->getValue();
            //array_values is needed to make sure the indexes are ordered from 0
            $intersect = array_values(array_intersect($intersect, $convertedArg));
        }

        return new self($intersect);
    }
94151
protected static function _getValue($from, $subject) {
		$cached = static::_getCache($from, $subject);
		if (isset($cached)) {
			return $cached;
		}

		$value = null;
		switch (true) {
			case is_array($subject):
				$value = Set::get($subject, $from);
				break;
			case is_object($subject) && is_string($from):
				if (isset($subject->$from)) {
					$value = $subject->$from;
				} elseif (method_exists($subject, $from)) {
					$value = $subject->{$from}();
				} else {
					throw new InvalidArgumentException('Method or attribute does not exists: ' . $from);
				}
				break;
			case is_numeric($subject) || is_string($subject):
				$value = $subject;
				break;
			case is_callable($from):
				$value = call_user_func($from, $subject);
				break;
			default:
				throw new InvalidArgumentException('Wrong type combination: subject -> ' . gettype($subject) . ', from -> ' . gettype($from));
		}

		if (is_array($value)) {
			$value = count($value);
		}
		static::_setCache($from, $subject, $value);
		return $value;
	}
968316
public function setMethod($method = self::GET)
	{
		if (in_array($method, $this->allowedMethods)) {
			$this->method = $method;
		} else {
			throw new RuntimeException('Invalid method setted.');
		}
		
		return $this;
	}
376528
public static function fromValue($value) {
        if (is_int($value)) {
            return new Type(Type::TYPE_LONG);
        } elseif (is_bool($value)) {
            return new Type(Type::TYPE_BOOLEAN);
        } elseif (is_double($value)) {
            return new Type(Type::TYPE_DOUBLE);
        } elseif (is_string($value)) {
            return new Type(Type::TYPE_STRING);
        }
        throw new \RuntimeException("Unknown value type found: " . gettype($value));
    }
343768
public function hit($key, $decaySeconds = 60)
    {
        $this->cache->add(
            $key.':timer', $this->availableAt($decaySeconds), $decaySeconds
        );

        $added = $this->cache->add($key, 0, $decaySeconds);

        $hits = (int) $this->cache->increment($key);

        if (! $added && $hits == 1) {
            $this->cache->put($key, 1, $decaySeconds);
        }

        return $hits;
    }
178817
public static function getValue($object, $propertyName)
    {
        /**
         * The error container
         *
         * @var \InvalidArgumentException|null $error
         */
        $error = null;

        foreach (self::$providers as $provider) {
            $error = null;
            $value = self::tryGetValue($provider, $object, $propertyName, $error);
            if (is_null($error)) {
                return $value;
            }
        }

        throw $error;
    }
1278210
public function read($size = 1024)
    {
        if (!is_resource($this->read)) {
            $this->read = fopen($this->filename, 'r+');
            if (!is_resource($this->read)) {
                throw new \RuntimeException('open file failed');
            }
            if (!$this->block) {
                $set = stream_set_blocking($this->read, false);
                if (!$set) {
                    throw new \RuntimeException('stream_set_blocking failed');
                }
            }
        }

        return fread($this->read, $size);
    }
246641
public function get($key)
    {
        $key       = (string)$key;
        $value     = null;
        $this->hit = false;

        if (\array_key_exists($key, self::$registry)) {
            if (self::$registry[$key]['expires'] >= (new DateTime())) {
                $this->hit = true;
                return $this->restoreDataStructure($key);
            }
            unset(self::$registry[$key]);
        }

        return $value;
    }
1014535
public function newFromHitBuilder($hit = array())
    {
        $key_name = $this->getKeyName();
        
        $attributes = $hit['_source'];

        if (isset($hit['_id'])) {
            $attributes[$key_name] = is_numeric($hit['_id']) ? intval($hit['_id']) : $hit['_id'];
        }
        
        // Add fields to attributes
        if (isset($hit['fields'])) {
            foreach ($hit['fields'] as $key => $value) {
                $attributes[$key] = $value;
            }
        }

        $instance = $this::newFromBuilderRecursive($this, $attributes);

        // In addition to setting the attributes
        // from the index, we will set the score as well.
        $instance->documentScore = $hit['_score'];

        // This is now a model created
        // from an Elasticsearch document.
        $instance->isDocument = true;

        // Set our document version if it's
        if (isset($hit['_version'])) {
            $instance->documentVersion = $hit['_version'];
        }

        return $instance;
    }