Find a class

@param array  $info      The class information
@param bool   $fallback  If TRUE use the fallback sequence
@return bool|mixed
777709
public function find(array $info, $fallback = true)
    {
        $result = false;

        //Find the class
        foreach($this->_sequence as $template)
        {
            $class = str_replace(
                array('<Package>'     ,'<Path>'      ,'<File>'      , '<Class>'),
                array($info['package'], $info['path'], $info['file'], $info['class']),
                $template
            );

            if(class_exists($class))
            {
                $result = $class;
                break;
            }

            if(!$fallback) {
                break;
            }
        }

        return $result;
    }
1152803
public function findClassFile($class,$baseDir = null)
    {
        $baseDir = is_null($baseDir) ? getcwd():$baseDir;

        $file = $this->mainLoader->findFile($class);
        if (is_file($file)) {
            $spl = PathUtil::createSplFileInfo($baseDir,$file);

            return $spl;
        }

        return false;
    }
455460
public function get_info($var = null, $default = null, $theme = null)
	{
		// if no theme is given
		if ($theme === null)
		{
			// if no var to search is given return the entire active info array
			if ($var === null)
			{
				return $this->active['info'];
			}

			// find the value in the active theme info
			if (($value = \Arr::get($this->active['info'], $var, null)) !== null)
			{
				return $value;
			}

			// and if not found, check the fallback
			elseif (($value = \Arr::get($this->fallback['info'], $var, null)) !== null)
			{
				return $value;
			}
		}

		// or if we have a specific theme
		else
		{
			// fetch the info from that theme
			$info = $this->load_info($theme);

			// and return the requested value
			return $var === null ? $info : \Arr::get($info, $var, $default);
		}

		// not found, return the given default value
		return $default;
	}
787651
public function fallback($fallback = null, array $params = [])
    {
        if ($fallback == null) {
            App::debug($this->serviceName . '服务，当前[' . $this->getCurrentState() . ']，服务降级处理，fallback未定义');
            return null;
        }

        if (is_array($fallback) && count($fallback) == 2) {
            list($fallbackObj, $method) = $fallback;
            App::debug($this->serviceName . '服务，服务降级处理，执行fallback, class=' . get_class($fallbackObj) . ' method=' . $method);

            return $fallbackObj->$method(...$params);
        }

        return null;
    }
297350
private function _get_template( $fallback = '' ) {
		$templates = $this->_templates();

		foreach ( $templates as $template ) {
			if ( file_exists( $template ) ) {
				return $template;
			}
		}

		return $fallback;
	}
469456
private function getFromCache($key, array $replace = array(), $locale = null, $fallback = true)
    {
        if (false === strpos($key, 'squanto::')) {
            $key = 'squanto::'.$key;
        }

        $result = parent::get($key, $replace, $locale, $fallback);

        return ($result !== $key) ? $result : null;
    }
1016566
final public static function getClassFile():\stdClass
    {
        $a = json_decode(file_get_contents(FEnv::get("framework.config.core.apps.file")));
        return ($a == null ? new \stdClass() : $a);
    }
18727
public function setFallbacks($fallback)
    {
        $this->localeFallbacks = (array)$fallback;
        if ($this->coreFormatter instanceof Multilingual) {
            $this->coreFormatter->setFallbacks($this->localeFallbacks);
        }
        if ($this->textProvider instanceof Multilingual) {
            $this->textProvider->setFallbacks($this->localeFallbacks);
        }
        return $this;
    }
1208815
protected function classForCode($code)
    {
        if (isset(self::$respClassMap[$code])) {
            return self::$respClassMap[$code];
        }

        return null;
    }
1091042
public static function classFromRequest(Request $request, $fallbackClass = null)
    {
        /** @var AbstractHandler $handlerClass */
        foreach (static::$handlers as $handlerClass) {
            if ($handlerClass::canBeUsedForRequest($request)) {
                return $handlerClass;
                break;
            }
        }

        if (is_null($fallbackClass)) {
            // the default handler
            return static::$fallbackHandler;
        }

        return $fallbackClass;
    }
180191
protected function _setClassName($class, $fallback)
    {
        if (!class_exists($class)) {
            $class = $fallback;
        }
        $this->_className = $class;
        $this->_datetimeInstance = new $this->_className;
    }
386915
public function previous($fallback = false)
    {
        $referrer = $this->request->headers->get('referer');

        $url = $referrer ? $this->to($referrer) : $this->getPreviousUrlFromSession();

        if ($url) {
            return $url;
        } elseif ($fallback) {
            return $this->to($fallback);
        }

        return $this->to('/');
    }
626686
protected function get($configOption, $fallback = null) {
		return isset($this->configuration[$configOption]) ? $this->configuration[$configOption] : $fallback;
    }
1011537
public function autoload($class)
    {
        $isFallback = $this->isFallbackAutoloader();
        if (false !== strpos($class, self::NS_SEPARATOR)) {
            if ($this->loadClass($class, self::LOAD_NS)) {
                return $class;
            } elseif ($isFallback) {
                return $this->loadClass($class, self::ACT_AS_FALLBACK);
            }
            return false;
        }
        if (false !== strpos($class, self::PREFIX_SEPARATOR)) {
            if ($this->loadClass($class, self::LOAD_PREFIX)) {
                return $class;
            } elseif ($isFallback) {
                return $this->loadClass($class, self::ACT_AS_FALLBACK);
            }
            return false;
        }
        if ($isFallback) {
            return $this->loadClass($class, self::ACT_AS_FALLBACK);
        }
        return false;
    }
751654
public function findOne (array $array, $callback, $default = null) {
		$filtered = array_filter($array, $callback);
		return count($filtered) ? reset($filtered) : $default;
	}
55351
public function getMetaValue($metaName, $fallback = null)
    {
        $meta = $this->getMeta();
        return array_key_exists($metaName, $meta) ? $meta[$metaName] : $fallback;
    }
131027
public function findFallbackAsset($asset, $Folder = null)
    {
        $folderEmpty = empty($Folder);
        $folderAllowFallback = ! empty($Folder) && $Folder->getFallback();

        if ($folderEmpty || $folderAllowFallback) {
            $fallbackPath = $this->engine->getDirectory();

            $fallbackPath = $this->removeViewFromPath($fallbackPath);
            if (file_exists($fallbackPath . DS . $asset)) {
                $this->createSymlink($fallbackPath);

                return '/' . $this->assetDir . '/' . $this->asset['asset'];
            }
        }

        return false;
    }