Gets the content of the current path and returns
the data requested.

@param string $data
@return int|null
324910
protected function getPathContent($data)
	{
		$info = file_get_contents($this->path);
		list($expires, $hits) = explode(',', $info);
		if ($expires <= time())
		{
			// it has expires
			unlink($this->path);
			$hits    = 0;
			$expires = null;
		}
		if ($data == 'hits')
		{
			return $hits;
		}
		if ($data == 'expires')
		{
			return $expires;
		}

		return null;
	}
514790
public function getValue($data)
    {
        if (is_object($data)) {
            return $this->getReflection()->getValue($data);
        }

        if (isset($data[$this->attributeName])) {
            return $data[$this->attributeName];
        }

        return null;
    }
1260195
private static function getNodeByWeight($data) {
		if ($data == null || count ( $data ) == 0) {
			return null;
		}
		$weight = 0;
		$tempdata = [ ];
		foreach ( $data as $one ) {
			if (! isset ( $one ['weight'] )) {
				return $data [0];
			}
			$weight += $one ['weight'];
			for($i = 0; $i < $one ['weight']; $i ++) {
				$tempdata [] = $one;
			}
		}
		$use = rand ( 0, $weight - 1 );
		return $tempdata [$use]['url'];
	}
1220690
public function createNew($data)
    {
        if ($data instanceof File) {
            /** @var $data File */
            $media = new Media();
            if (method_exists($data, 'getClientOriginalName')) {
                $media->setOriginalFilename($data->getClientOriginalName());
            } else {
                $media->setOriginalFilename($data->getFilename());
            }
            $media->setContent($data);

            $contentType = $this->mimeTypeGuesser->guess($media->getContent()->getPathname());
            $media->setContentType($contentType);

            return $media;
        }

        return null;
    }
303067
public function getAfterSaveRoute($data) {
        if ($currentItem = $this->menu->getCurrent()) {
            $controller = $this->_getParam('controller');
            $url        = null;

            if ($data instanceof \Zend_Controller_Request_Abstract) {
                $refData = $data;
            } elseif (is_array($data)) {
                $refData = $this->getModel()->getKeyRef($data) + $data;
            } else {
                throw new \Gems_Exception_Coding('The variable $data must be an array or a ' . 'Zend_Controller_Request_Abstract object.');
            }

            if ($parentItem = $currentItem->getParent()) {
                if ($parentItem instanceof \Gems_Menu_SubMenuItem) {
                    $controller = $parentItem->get('controller');
                }
            }

            // Look for allowed show
            if ($menuItem = $this->menu->find(array('controller' => $controller, 'action' => 'show', 'allowed' => true))) {
                $url = $menuItem->toRouteUrl($refData);
            }

            if (null === $url) {
                // Look for allowed index
                if ($menuItem = $this->menu->find(array('controller' => $controller, 'action' => 'index', 'allowed' => true))) {
                    $url = $menuItem->toRouteUrl($refData);
                }
            }

            if ((null === $url) && ($parentItem instanceof \Gems_Menu_SubMenuItem)) {
                // Still nothing? Try parent item.
                $url = $parentItem->toRouteUrl($refData);
            }

            if (null !== $url) {
                return $url;
            }
        }
        return false;
    }
1158051
public function get($filename)
    {
        $filename = $this->path($filename);

        if (!(is_file($filename) && stream_is_local($filename))) {
            return null;
        }

        return file_get_contents($filename);
    }
830783
public static function get()
    {
        $content = file_get_contents(self::getFilename());

        return $content ? json_decode($content, true) : null;
    }
870124
public static function extract(array $data, string $path)
    {
        if ('' === $path) {
            return $data;
        }

        $steps = explode('.', $path);
        $actual = $data;
        foreach ($steps as $step) {
            if (!array_key_exists($step, $actual)) {
                return null;
            }

            $actual = $actual[$step];
        }

        return $actual;
    }
41867
public static function get($key)
    {
        $path = Cache::path($key);

        if (file_exists($path)) {
            return file_get_contents($path);
        }

        return null;
    }
458888
public function xml($data)
    {
        if (isset($data['url']) && ! empty($data['url'])) {
            $result = @file_get_contents($data['url']);
            $result = XmlFormatter::encode($result);
        }
        return isset($result) ? $result : null;
    }
1340235
public function get($data = [])
	{
		// Process data given.
		$processPayload = $this->process(__FUNCTION__, $data);

		if( ! $processPayload->isStatus(Payload::STATUS_VALID))
		{
			return $processPayload;
		}

		// Get a properly formatted Entity Class string.
		$entityContext = $this->formatEntityType($processPayload->getData()['entity_type']);

		return $this->aggregate[$entityContext]->get($processPayload->getData()['filter'], $processPayload->getData()['sort'], $processPayload->getData()['field'], $processPayload->getData()['embed']);
	}
850702
public function getData($key = null)
    {
        if (!$key) {
            return $this->data;
        } else if ($this->hasKey($key)) {
            return $this->data[$key] ?? null;
        }

        return null;
    }
682276
public static function streamGetContents($data): string
    {
        // check if it's actually a resource, we can directly convert
        // string without any issue.
        if (! \is_resource($data)) {
            return $data;
        }

        // Get the content from stream.
        $hex = \stream_get_contents($data);

        // For some reason hex would always start with 'x' and if we
        // don't filter out this char, it would mess up hex to string
        // conversion.
        if (\preg_match('/^x(.*)$/', $hex, $matches)) {
            $hex = $matches[1];
        }

        // Check if it's actually a hex string before trying to convert.
        if (! \ctype_xdigit($hex)) {
            return $hex;
        }

        return static::fromHex($hex);
    }
307752
private function extractContentIds($data)
    {
        $ids = [];

        foreach ($data->response->docs as $doc) {
            $ids[] = $doc->content_id_id;
        }

        return $ids;
    }
1182029
protected function convertValue($data)
    {
        if ($this->isTraversable($data)) {
            return $this->recursiveConvertArray($data);
        }

        if (is_object($data)) {
            return $this->convertObject($data) ?: null;
        }

        return $data;
    }
201704
public function getDataForJSON($data = null)
    {
        if (is_null($data)) {
            $data = $this->getData();
        }

        $dataForJson = [$this->getEvidence() => $this->objectToID($data)];

        if (!is_null($this->action)) {
            $dataForJson[$this->evidence.'@action'] = $this->action;
            $this->action                           = null;
        }

        if (!is_null($this->filter)) {
            $dataForJson[$this->evidence.'@filter'] = $this->filter;
        }


        foreach ($this->chained as $chained) {
            $chainedData = $chained->getDataForJSON();
            foreach ($chainedData as $chainedItemEvidence => $chainedItemData) {
                if (array_key_exists($chainedItemEvidence, $dataForJson)) {
                    if (is_string(key($dataForJson[$chainedItemEvidence]))) {
                        $dataBackup                          = $dataForJson[$chainedItemEvidence];
                        $dataForJson[$chainedItemEvidence]   = [];
                        $dataForJson[$chainedItemEvidence][] = $dataBackup;
                    }
                    if (array_key_exists(0, $chainedItemData)) {
                        foreach ($chainedItemData as $chainedItem) {
                            $dataForJson[$chainedItemEvidence][] = $chainedItem;
                        }
                    } else {
                        $dataForJson[$chainedItemEvidence][] = $chainedItemData;
                    }
                } else {
                    $dataForJson[$chainedItemEvidence] = $chainedItemData;
                }
            }
        }


        return $dataForJson;
    }
548660
public function Get()
    {
        $filename = $this->GetPathToFile();
        if (!file_exists($filename)) {
            return null;
        }
        
        $data = file_get_contents($filename);
        if ($data === false) {
            return null;
        }
        
        $serialized = str_replace($this->_prefixContent, '', $data);
        return unserialize($serialized);
    }