Lazy loading of folder property

@return Folder
969026
public function getFolder()
    {
        if (is_null($this->_folder)) {
            $this->_folder = new Folder(
                array(
                    'name' => "{$this->_path}/{$this->_dirName}",
                    'autoCreate' => true
                )
            );
        }
        return $this->_folder;
    }
223690
protected function getCurrentFolderPermissions()
    {
        if ($this->currentFolderPermissions === null) {
            $folder = $this->getCurrentFolder();
            if ($folder === null) {
                $folder = $this->app->make(Filesystem::class)->getRootFolder();
                if ($folder === null) {
                    $folder = new FileFolder();
                }
            }
            $this->currentFolderPermissions = new Checker($folder);
        }

        return $this->currentFolderPermissions;
    }
601277
public function createFolder($folder = null)
    {
        $folder = $this->paths->getFolder($folder);
        $this->modulable->toHistory('mkdir '.$folder);

        return $this->modulable->getConnection()->createDir($folder);
    }
316134
public function getStaticProperties()
    {
        if ($this->staticProperties === null) {
            // lazy load class properties list
            foreach ($this->node->stmts as $stmt) {
                if ($stmt instanceof Node\Stmt\Property) {
                    if ($stmt->isStatic() === false) {
                        continue;
                    }
                    foreach ($stmt->props as $prop) {
                        $this->staticProperties[] = new PropertyModel($this, $prop);
                    }
                }
            }
        }
        return $this->staticProperties;
    }
1185774
public function getDirectoriesIterator()
    {
        if (array() !== ($directories = $this->getDirectories())) {
            return Finder::create()
                    ->files()
                    ->filter($this->getBlacklistFilter())
                    ->ignoreVCS(true)
                    ->in($directories);
        }

        return null;
    }
608367
public function getFolder($path = '')
    {
        if (!array_key_exists($path,$this->folders)) {

            $this->folders[$path] = false;

            $url = 'files';
            $path = trim($path, '/');
            if ($path != '') {
                $url .= '/' . $path;
            }

            $response = $this->getClient()->get($url);
            $json = $response->json();

            if ($json) {

                if ($this->publicUrl != false) {
                    $files = [];
                    foreach ($json['files'] as $file) {
                        $file['urls']['default'] = $this->publicUrl . '/' . $file['id'];
                        $files[] = $file;
                    }
                    $json['files'] = $files;
                }
                $folder = new Folder($path, $json);


                $this->folders[$path] = $folder;
            }

        }

        return $this->folders[$path];
    }
1272085
protected function getCacheDirectory()
    {
        $cache_dir = false;

        if ($this->cacheDir && is_dir($this->cacheDir)) {
            $twig_cache = $this->cacheDir . self::CACHE_DIR;
            if (is_dir($twig_cache) && is_writable($twig_cache)) {
                $cache_dir = $twig_cache;
            } else {

                // Attempt to create twig cache dir
                $fs = new FileSystem();

                try {
                    $fs->mkdir($twig_cache);
                } catch (\Exception $e) {}

                $cache_dir = $twig_cache;
            }
        }

        return($cache_dir);
    }
652787
public function getFolder()
    {
        if ($this->_folder === null) {
            $this->_folder = Yii::getAlias("@webroot/svg");
        }

        return rtrim($this->_folder, DIRECTORY_SEPARATOR);
    }
329793
private CMFolder loadFoldersStructure()
    {
        CMFolder rootFolder = new CMFolder( getRootId(), "root" );

        HttpPost request = buildSoapRequest( "getFolderXML", "<folder id='" + rootFolder.getId() + "'/>" );
        CResponse response = retryStrategy.invokeRetry( getApiRequestInvoker( request, null ) );
        Element rootElement = findRootFolderElement( response.asDom() );

        scanFolderLevel( rootElement, rootFolder );

        return rootFolder;
    }
107878
public function actionDataFolders()
    {
        return $this->getOrSetHasCache('storageApiDataFolders', function () {
            $folders = [];
            foreach (Yii::$app->storage->findFolders() as $key => $folder) {
                $folders[$key] = $folder->toArray();
                $folders[$key]['toggle_open'] = (int) Yii::$app->adminuser->identity->setting->get('foldertree.'.$folder->id);
                $folders[$key]['subfolder'] = Yii::$app->storage->getFolder($folder->id)->hasChild();
            }
            return $folders;
        }, 0, new DbDependency(['sql' => 'SELECT MAX(id) FROM {{%admin_storage_folder}} WHERE is_deleted=false']));
    }
133050
public function setFolder(ChildFolder $v = null)
    {
        if ($v === null) {
            $this->setFolderId(NULL);
        } else {
            $this->setFolderId($v->getId());
        }

        $this->aFolder = $v;

        // Add binding for other direction of this n:n relationship.
        // If this object has already been added to the ChildFolder object, it will not be re-added.
        if ($v !== null) {
            $v->addDealerFolder($this);
        }


        return $this;
    }
168030
protected function getIterator($folder)
    {
        $iterator = new \RecursiveIteratorIterator(
            new \RecursiveDirectoryIterator($folder,
                \RecursiveDirectoryIterator::SKIP_DOTS),
            \RecursiveIteratorIterator::SELF_FIRST,
            \RecursiveIteratorIterator::CATCH_GET_CHILD // Ignore "Permission denied"
        );
        $files = new RegexIterator($iterator, '/^.+Exception\.php$/i', RecursiveRegexIterator::GET_MATCH);

        return $files;
    }
153060
public static function publicFolder()
    {
        $folder = self::baseFolder();
        $publicDir = self::publicDir();
        if ($publicDir) {
            return Path::join($folder, $publicDir);
        }

        return $folder;
    }
922853
public function getFile() {

		if(null === $this -> file) {

			$file = $this -> getFileName();
			$this -> file = new File($this -> directory . $file);
		}

		return $this -> file;
	}
258728
public function getRootPath()
  {
    $folder = WebApp::getPageFolder() . $this->code;
    if (StringTools::right($folder, 1) != '/') {
      $folder .= '/';
    }
    return $folder;
  }
395800
public function current()
    {
        if($this->folderList == null){
            $this->folderList = $this->listFolder();
        }
        return $this->folderList[$this->key];
    }
888908
protected function getCurrentFolder()
    {
        if ($this->currentFolder === false) {
            $currentFolder = null;
            $fID = $this->request->request->get('currentFolder', $this->request->query->get('currentFolder'));
            if ($fID && is_scalar($fID)) {
                $fID = (int) $fID;
                if ($fID !== 0) {
                    $node = Node::getByID($fID);
                    if ($node instanceof FileFolder) {
                        $currentFolder = $node;
                    }
                }
            }
            $this->setCurrentFolder($currentFolder);
        }

        return $this->currentFolder;
    }