Tries to find a partial within registered directories

@param string $name Partial name
@return mixed
962408
private function findPartialFile($name)
    {
        foreach ($this->partialDirs as $dir) {
            $file = $this->createPartialPath($dir, $name);

            if (is_file($file)) {
                return $file;
            }
        }

        return false;
    }
664674
public function findThemePathByName($name)
    {
        // check the theme from the config
        $path = null;

        foreach ($this->themesDirectories as $themeDir) {
            $path = rtrim($themeDir, '\\/').\DIRECTORY_SEPARATOR.$name;
            if (0 !== strpos($path, 'phar://')) {
                $path = realpath($path);
            }

            if (is_dir($path)) {
                break;
            }
        }

        return $path;
    }
829855
public function loadPartial($name)
    {
        try {
            if (isset($this->partialsLoader)) {
                $loader = $this->partialsLoader;
            } elseif (isset($this->loader) && !$this->loader instanceof Mustache_Loader_StringLoader) {
                $loader = $this->loader;
            } else {
                throw new Mustache_Exception_UnknownTemplateException($name);
            }

            return $this->loadSource($loader->load($name));
        } catch (Mustache_Exception_UnknownTemplateException $e) {
            // If the named partial cannot be found, log then return null.
            $this->log(
                Mustache_Logger::WARNING,
                'Partial not found: "{name}"',
                array('name' => $e->getTemplateName())
            );
        }
    }
563423
public function isDir(string $name)
    {
        $current = $this->pwd();
        try {
            $this->chDir($name);
            $this->chDir($current);
            return true;
        } catch (\Exception $e) {
            // do nothing
        }
        return false;
    }
260990
public function getSource($name)
    {
        try {
            return file_get_contents($this->findTemplate($name));
        } catch (\Exception $exception) {
            return $this->decoratedLoader->getSource($name);
        }
    }
270843
public function pull($name) {
        $result = $this->get($name, false);
        if ($result) {
            $this->rm($name);
            return $result;
        }
        else {
            return;
        }
    }
5251
public function get($name = null)
    {
        if (is_null($name)) {
            return $this->all();
        }

        return $this->find($name);
    }
532494
protected function findFallbackObject($name)
    {
        if (strpos($name, '::') !== false) {
            return false;
        }

        if (array_key_exists($name, $this->fallbackCache)) {
            return $this->fallbackCache[$name];
        }

        return $this->fallbackCache[$name] = CmsPartial::find($name);
    }
149130
public static function find($name)
    {
        if (!is_dir(DOCROOT.THEME_DIR.'/'.$name)) return false;
        if (!file_exists(DOCROOT.THEME_DIR.'/'.$name.'/'.THEME_INFO)) return false;
        return new self($name);
    }
617255
public function find($name)
    {
        try {
            return parent::find($name);
        } catch (\InvalidArgumentException $e) {
            $this->shortcut = true;

            return parent::find('run');
        }
    }
729265
protected function removePartial($name): bool
    {
        $status = true;
        foreach (scandir($this->path) as $file) {
            if (pathinfo($this->path . $file, PATHINFO_EXTENSION) !== "cache") {
                continue;
            }
            if (strpos($file, $name) !== false) {
                $status = unlink($this->path . $file) && $status;
            }
        }
        return $status;
    }
120631
public static function getDescriptionByName($name)
    {
        $key = strtoupper($name);
        if (isset(self::$availableNameList[$key])) {
            return self::$availableNameList[$key];
        } else {
            return false;
        }
    }
1081502
public function getSource($name)
    {
        // strip front-matter
        $parts = preg_split('/[\n]*[-]{3}[\n]/', $name, 2);
        if (count($parts) === 2) {
            return ltrim($parts[1]);
        }
        return $name;
    }
1141054
public function findMatched($name, $default = null)
    {
        if (is_null($name)) {
            return $default;
        }
        if (!in_array($name, $this->areas)) {
            return $default;
        }
        return $name;
    }
359597
protected function _getLayoutPartialPath($name)
    {
        list($plugin, $name) = $this->pluginSplit($name);

        $paths       = $this->_paths($plugin);
        $layoutPaths = $this->_getSubPaths('Layout' . DS . 'Partial');

        foreach ($paths as $path) {
            foreach ($layoutPaths as $layoutPath) {
                $partial = $path . $layoutPath . DS . $name . $this->_ext;
                if (FS::isFile($partial)) {
                    return $partial;
                }
            }
        }

        return false;
    }
272150
public function getAll($name)
    {
        $s = $this->getNormalizedHeaderName($name);
        $ret = [];
        if (!empty($this->headerMap[$s])) {
            foreach ($this->headerMap[$s] as $index) {
                $ret[] = $this->getByIndex($index);
            }
        }
        return $ret;
    }
969009
public function findAllByName($name)
    {
        $datasourceNodes = array();
        foreach ($this->findAll() as $datasourceNode) {
            if ($datasourceNode->getName() === $name) {
                $datasourceNodes[$datasourceNode->getPrimaryKey()] = $datasourceNode;
            }
        }

        return $datasourceNodes;
    }