Classes/Cundd/Noshi/Domain/Repository/PageRepository.php
public function findByIdentifier($identifier)
    {
        if (isset($this->allPages[$identifier])) {
            return $this->allPages[$identifier];
        }

        $rawPageData = null;
        $configuration = ConfigurationManager::getConfiguration();
        $dataPath = $configuration->get('basePath') . $configuration->get('dataPath');

        $pageName = $this->getPageNameForPageIdentifier($identifier);
        $pageDataPath = $dataPath . $pageName . '.' . $configuration->get('dataSuffix');
        $directoryDataPath = $dataPath . $pageName;
        $metaDataPath = $dataPath . $pageName . '.json';

        $lastSlashPosition = strrpos($pageName, '/');

        $hiddenPageDataPath = $dataPath . substr($pageName, 0, $lastSlashPosition)
            . '_' . substr($pageName, $lastSlashPosition)
            . '.' . $configuration->get('dataSuffix');

        $whiteSpacePageDataPath = $dataPath . str_replace(Page::URI_WHITESPACE_REPLACE, ' ', $pageName)
            . '.'
            . $configuration->get('dataSuffix');

        // Check if the node exists
        if (file_exists($pageDataPath)) {
            $rawPageData = file_get_contents($pageDataPath);
        } else {
            if (file_exists($whiteSpacePageDataPath)) {
                $pageDataPath = $whiteSpacePageDataPath;
                $rawPageData = file_get_contents($pageDataPath);
            } else {
                if (file_exists($hiddenPageDataPath)) {
                    $pageDataPath = $hiddenPageDataPath;
                    $rawPageData = file_get_contents($pageDataPath);
                } else {
                    if (!(file_exists($directoryDataPath) || file_exists($metaDataPath))) {
                        return null;
                    }
                }
            }
        }

        $page = new Page($identifier, $rawPageData, $this->buildMetaDataForPageIdentifier($identifier, $pageDataPath));
        $this->allPages[$identifier] = $page;

        return $page;
    }
public function findByIdentifier($identifier)
    {
        if (isset($this->allPages[$identifier])) {
            return $this->allPages[$identifier];
        }

        $rawPageData = null;
        $configuration = ConfigurationManager::getConfiguration();
        $dataPath = $configuration->get('basePath') . $configuration->get('dataPath');

        $pageName = $this->getPageNameForPageIdentifier($identifier);
        $pageDataPath = $dataPath . $pageName . '.' . $configuration->get('dataSuffix');
        $directoryDataPath = $dataPath . $pageName;
        $metaDataPath = $dataPath . $pageName . '.json';

        $lastSlashPosition = strrpos($pageName, '/');

        $hiddenPageDataPath = $dataPath . substr($pageName, 0, $lastSlashPosition)
            . '_' . substr($pageName, $lastSlashPosition)
            . '.' . $configuration->get('dataSuffix');

        $whiteSpacePageDataPath = $dataPath . str_replace(Page::URI_WHITESPACE_REPLACE, ' ', $pageName)
            . '.'
            . $configuration->get('dataSuffix');

        // Check if the node exists
        if (file_exists($pageDataPath)) {
            $rawPageData = file_get_contents($pageDataPath);
        } else {
            if (file_exists($whiteSpacePageDataPath)) {
                $pageDataPath = $whiteSpacePageDataPath;
                $rawPageData = file_get_contents($pageDataPath);
            } else {
                if (file_exists($hiddenPageDataPath)) {
                    $pageDataPath = $hiddenPageDataPath;
                    $rawPageData = file_get_contents($pageDataPath);
                } else {
                    if (!(file_exists($directoryDataPath) || file_exists($metaDataPath))) {
                        return null;
                    }
                }
            }
        }

        $page = new Page($identifier, $rawPageData, $this->buildMetaDataForPageIdentifier($identifier, $pageDataPath));
        $this->allPages[$identifier] = $page;

        return $page;
    }
Find the page with tie given identifier

@param string $identifier
@return Page