Climbs the folder hierarchy until there's a CanViewType that does not equal Inherit

@return String The first valid CanViewType of this File
351911
public function getViewType() {
        $perm = null;

        if ($this->owner->CanViewType == 'Inherit') {
            if ($this->owner->ParentID) {
                $perm = $this->owner->Parent()->getViewType();
            } else {
                $member = Member::currentUser();
                $perm = $this->owner->defaultPermissions($member);
            }
        } else {
            $perm = $this->owner->CanViewType;
        }

		$default = Config::inst()->get('SecureAssets', 'Defaults');

		$default = isset($default['Permission']) ? $default['Permission'] : CDNFile::ANYONE_PERM;

        return $perm ? $perm : $default;
	}
157363
public function next_sibling()
    {
        if ($this->parent === null) {
            return null;
        }

        $idx = 0;
        $count = count($this->parent->children);
        while ($idx < $count && $this !== $this->parent->children[$idx]) {
            ++$idx;
        }
        if (++$idx >= $count) {
            return null;
        }
        return $this->parent->children[$idx];
    }
1187949
private function makeRoot()
    {
        $this->lft = 1;
        $this->rgt = 2;
        $this->level = 1;
        $this->root = $this->getMaxRoot();

        return $this;
    }
1267114
protected final function getParent()
	{
		if($this->parent === false)
		{
			if(NULL === ($file = $this->getExtended()))
			{
				$this->parent = NULL;
			}
			else
			{
				$typeName = $this->factory->createView($this->renderer, $this->resolveResource($file));
				
				$this->parent = new $typeName($this->factory, $this->renderer);
				$this->parent->inherit($this->context, $this->exp);
			}
		}
		
		return $this->parent;
	}
1007063
public function getFirst()
    {
        $this->internalDataListUpdate();
        if (isset($this->internalDataListData[0])) {
            return $this->internalDataListUpdateValueIfNeeded($this->internalDataListData, 0);
        }
        return null;
    }
1321935
public function sortKey() {
    if ($this instanceof RootNode) {
      return spl_object_hash($this);
    }
    if (!$this->parent) {
      return '~/' . spl_object_hash($this);
    }
    $path = $this->parent->sortKey() . '/';
    $position = 0;
    $previous = $this->previous;
    while ($previous) {
      $position++;
      $previous = $previous->previous;
    }
    $path .= $position;
    return $path;
  }
674282
public function findDescendantsWithTrashed()
    {
        return static::withTrashed()->where($this->getTreeColumn('path'), 'LIKE', $this->{$this->getTreeColumn('path')} . '%')
            ->orderBy($this->getTreeColumn('level'), 'ASC');
    }
63069
protected function getRootPagesWithIndexingOff()
    {
        $rootPages = $this->getRootPages();
        $rootPagesWithIndexingOff = [];

        foreach ($rootPages as $rootPage) {
            try {
                $this->initializeTSFE($rootPage);
                $solrIsEnabledAndIndexingDisabled = $this->getIsSolrEnabled() && !$this->getIsIndexingEnabled();
                if ($solrIsEnabledAndIndexingDisabled) {
                    $rootPagesWithIndexingOff[] = $rootPage;
                }
            } catch (\RuntimeException $rte) {
                $rootPagesWithIndexingOff[] = $rootPage;
            } catch (ServiceUnavailableException $sue) {
                if ($sue->getCode() == 1294587218) {
                    //  No TypoScript template found, continue with next site
                    $rootPagesWithIndexingOff[] = $rootPage;
                    continue;
                }
            }
        }

        return $rootPagesWithIndexingOff;
    }
442340
protected function buildFolderTree($parent, $visible, $level, $maxLevel, $exclude, &$resultsList)
    {
        if ($level > $maxLevel) {
            return;
        }

        $search = FolderQuery::create();

        $this->configureI18nProcessing($search, array(
                    'TITLE'
                ));

        $search->filterByParent($parent);

        if ($visible != BooleanOrBothType::ANY) {
            $search->filterByVisible($visible);
        }

        if ($exclude != null) {
            $search->filterById($exclude, Criteria::NOT_IN);
        }

        $search->orderByPosition(Criteria::ASC);

        $results = $search->find();

        foreach ($results as $result) {
            $resultsList[] = array(
                "ID" => $result->getId(),
                "TITLE" => $result->getVirtualColumn('i18n_TITLE'),
                "PARENT" => $result->getParent(),
                "URL" => $this->getReturnUrl() ? $result->getUrl($this->locale) : null,
                "VISIBLE" => $result->getVisible() ? "1" : "0",
                "LEVEL" => $level,
                'CHILD_COUNT' => $result->countChild(),
            );

            $this->buildFolderTree($result->getId(), $visible, 1 + $level, $maxLevel, $exclude, $resultsList);
        }
    }
621541
protected function _getView()
	{
		if ($viewInstance = Registry::get('view')) {
			return $viewInstance;
		}

		$request = Agl::getRequest();
		$module  = $request->getModule();
		$view    = $request->getView();

		$viewPath = APP_PATH
                    . Agl::APP_PHP_DIR
                    . ViewInterface::APP_PHP_DIR
                    . DS
                    . $module
                    . DS
                    . $view
                    . Agl::PHP_EXT;

        if (file_exists($viewPath)) {
            $className    = $module . ucfirst($view) . ViewInterface::APP_VIEW_SUFFIX;
            $viewInstance = Agl::getInstance($className);
        } else {
            $viewInstance = new View();
        }

        $viewInstance->setFile($module . DS . $view);

        Registry::set('view', $viewInstance);

        return $viewInstance;
	}
241839
public function getAllowedFileTypes()
	{
		$arrFileTypesOfParents = array();
		
		if ($this->fileTypesInherit && !$this->isRootCategory() && $this->hasParentCategory())
		{
			$arrFileTypesOfParents = $this->parentCategory->getAllowedFileTypes();
		}
		
		$arrFileTypes = DmsUtils::getUniqueFileTypes($this->fileTypes, $arrFileTypesOfParents);
		
		return $arrFileTypes;
	}
1222642
public function getRaiseDuration()
    {
        if (!$this->raise_duration && $this->getSpecies()) {
            return $this->getSpecies()->getRaiseDuration();
        }

        return $this->raise_duration;
    }
423535
public function getView()
    {
        if (view()->exists($this->view)) {
            return $this->view;
        }

        if (view()->exists('admin.'.$this->urlPrefix().'.index')) {
            return 'admin.'.$this->urlPrefix().'.index';
        }

        if (view()->exists('admin.'.$this->urlPrefix())) {
            return 'admin.'.$this->urlPrefix();
        }

        if (view()->exists('flare::'.$this->view)) {
            return 'flare::'.$this->view;
        }

        return parent::getView();
    }
1165188
public static function root()
    {
        $url = request('REQUEST_URI', '', 'server');
        $root = request('DOCUMENT_ROOT', '', 'server');
        $scheme = request('REQUEST_SCHEME', '', 'server');
        $server = request('SERVER_NAME', '', 'server');

        $url = substr($url, 1);

        $parts = explode('/', $url);
        //
        $folder = '';
        //
        for ($i = 0; $i < count($parts); $i++) {
            if (File::isDirectory($root.$folder.$parts[$i].'/')) {
                $folder .= $parts[$i].'/';
            } else {
                break;
            }
        }

        return $scheme.'://'.$server.'/'.$folder;
    }
820861
public function first()
    {
        $this->index = \count($this->children) ? 0 : (-1);

        if ($this->index === -1) {
            return null;
        }

        return $this->current();
    }
84577
public function parent()
    {
        return $this->filter([
            'lft__lt' => $this->getModel()->lft,
            'rgt__gt' => $this->getModel()->rgt,
            'level' => $this->getModel()->level - 1,
            'root' => $this->getModel()->root,
        ]);
    }
868810
public function getNumberDescendants()
	{
		$intervalSize = $this->getIntervalSize();
		$intervalSize = $intervalSize - 1;
		
		if ($intervalSize % 2 != 0) {
			$dump = static::dump($this);
			throw new Exception\InvalidStructure("The size of node {$dump} must be odd number, even number received");
		}
		$descendantCount = (int) ($intervalSize / 2);
		
		return $descendantCount;
	}