Saves the raw report data to a path you specify
@param string $path <p>filename to save the file in</p>
@return boolean <b>FALSE</b> if something goes wrong
426341
public function saveReport($path){
        if (!isset($this->rawreport)){
            return false;
        }
        try{
            file_put_contents($path, $this->rawreport);
            $this->log("Successfully saved report #".$this->options['ReportId']." at $path");
        } catch (Exception $e){
            $this->log("Unable to save report #".$this->options['ReportId']." at $path: $e",'Urgent');
            return false;
        }
    }
1275619
private function createPathIfNeeded(string $path) : bool
    {
        if (! is_dir($path)) {
            if (@mkdir($path, 0777 & (~$this->umask), true) === false && ! is_dir($path)) {
                return false;
            }
        }

        return true;
    }
623533
public function parseFile(string $path): bool
    {
        static::$iteration++;
        if (static::$iteration > 10) exit();
        if (in_array($path, $this->parsed_files)) {
            // The file has already been parsed, don't parse it again
            return true;
        }
        $this->parsed_files[] = $path;
        if (is_readable($path)) {
            $array = include($path);
        } else {
            if (isset(Core::i()->log)) {
                Core::i()->log->debug('Config path ' . $path . ' could not be read.');
            }
            return false;
        }
        if (!is_array($array)) {
            if (isset(Core::i()->log)) {
                Core::i()->log->debug('Config file ' . $path . ' is not an array.');
            }
            return false;
        }
        $this->parseArray($array);
        return true;
    }
1253453
protected function isWithinFilesystem($path)
    {
        $pathUrl = new Url($path);
        $fsUrl = $this->filesystem->url();

        if (!$pathUrl->scheme) {
            $pathUrl = $pathUrl->scheme('file');
        }

        if (!$fsUrl->scheme) {
            $fsUrl = $fsUrl->scheme('file');
        }

        if ($pathUrl->scheme != $fsUrl->scheme) {
            return false;
        }

        if (Helper::startsWith("$pathUrl->path", "$fsUrl->path")) {
            return true;
        }

        return $this->filesystem->exists($path);
    }
231709
public function createDir( $path )
    {
        if ( empty( $path ) )
        {
            return false;
        }

        $path = $this->validPath( $path );
        $base = $this->baseUrl . '/' . $path;
        $full = $this->baseDir . '/' . $base;

        if ( ! is_dir( $full ) && ! is_file( $full ) )
        {
            $rights = $this->rights( $path );

            if ( $rights->write && @ mkdir( $full, 0777, true ) )
            {
                return $path;
            }
        }

        return false;
    }
141932
public function setFileInfoFromPath($path)
    {
        $info = pathinfo($path);
        $this->dirname = array_key_exists('dirname', $info) ? $info['dirname'] : null;
        $this->basename = array_key_exists('basename', $info) ? $info['basename'] : null;
        $this->extension = array_key_exists('extension', $info) ? $info['extension'] : null;
        $this->filename = array_key_exists('filename', $info) ? $info['filename'] : null;

        if (file_exists($path) && is_file($path)) {
            $this->mime = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path);
        }

        return $this;
    }
1261657
public function writeFile($path)
    {
        $fullPath = $this->viewDir . DIRECTORY_SEPARATOR . $this->transformDotToSlash($path) . '.blade.php';

        if (!FacadeStorage::has($fullPath)) {
            FacadeStorage::createDir(dirname($fullPath));
            return FacadeStorage::write($fullPath, '');
        }

        return false;
    }
327152
private static function checkSavePath($path) {
            if (is_string($path)) {
                $dir = dirname($path);

                return file_exists($dir) && is_writeable($dir);
            } elseif (is_resource($path)) {
                return true;
            }

            return false;
        }
1128311
private function saveCacheFile($path, $data)
	{
		if (!is_writable($this->dir)) {
		    throw new \InvalidArgumentException(sprintf('The directory "%s" is not writable. Both, the webserver and the console user need access. You can manage access rights for multiple users with "chmod +a". If your system does not support this, check out the acl package.', $this->dir));
		}

		$tempfile = tempnam($this->dir, uniqid('', true));

		if (false === $tempfile) {
		    throw new \RuntimeException(sprintf('Unable to create tempfile in directory: %s', $this->dir));
		}

		$written = file_put_contents($tempfile, '<?php return unserialize('.var_export(serialize($data), true).');');

		if (false === $written) {
		    throw new \RuntimeException(sprintf('Unable to write cached file to: %s', $tempfile));
		}

		@chmod($tempfile, 0666 & (~$this->umask));

		if (false === rename($tempfile, $path)) {
		    @unlink($tempfile);
		    throw new \RuntimeException(sprintf('Unable to rename %s to %s', $tempfile, $path));
		}
	}
1269853
public function save($path, $quality = array()) {
		$ext = pathinfo($path, PATHINFO_EXTENSION);

		$jpeg_quality = elgg_extract('jpeg_quality', $quality);
		$png_quality = elgg_extract('png_quality', $quality);
		$png_filter = elgg_extract('png_filter', $quality);

		switch ($ext) {
			default :
				$this->source->saveToFile($path, $jpeg_quality);
				break;

			case 'gif';
				$this->source->saveToFile($path);
				break;

			case 'png' :
				$this->source->saveToFile($path, $png_quality, $png_filter);
				break;
		}

		return $this;
	}
115156
public function save($path = null, $quality = null)
    {
        $path = is_null($path) ? $this->basePath() : $path;

        if (is_null($path)) {
            throw new Exception\NotWritableException(
                "Can't write to undefined path."
            );
        }

        $data = $this->encode(pathinfo($path, PATHINFO_EXTENSION), $quality);
        $saved = @file_put_contents($path, $data);

        if ($saved === false) {
            throw new Exception\NotWritableException(
                "Can't write image data to path ({$path})"
            );
        }

        // set new file info
        $this->setFileInfoFromPath($path);

        return $this;
    }
414641
public function save($path, $filename)
    {
        if (!file_exists($path)) {
            $this->makeDirectory($path);
        }

        return file_put_contents($path . '/' . $filename, $this->getContents());
    }
1367537
public function createFile($path)
    {
        $node = $this->at($path);
        if ($node !== null && $node->type == 'dir') {
            return false;
        }

        $node = $this->at(dirname($path));
        if (null === $node) {
            return false;
        }

        $this->at($path, (object) [
            'type' => 'file',
            'perms' => 0664,
            'content' => ''
        ]);
        return true;
    }
751435
public function unlink(string $path): bool
    {
        $realPath = $this->resolvePath(vfsStream::path($path));
        $content  = $this->getContent($realPath);
        if (null === $content) {
            trigger_error('unlink(' . $path . '): No such file or directory', E_USER_WARNING);
            return false;
        }

        if ($content->getType() !== vfsStreamContent::TYPE_FILE) {
            trigger_error('unlink(' . $path . '): Operation not permitted', E_USER_WARNING);
            return false;
        }

        return $this->doUnlink($realPath);
    }
179590
public static function delete($path)
	{
		if (is_dir($path)) {
			Dir::delete($path);
		} elseif (is_file($path)) {
			File::delete($path);
		}

		return true;
	}
1277344
protected function saveBlockByPath($path)
    {
        $info = FileHelper::classInfo($path);
        
        if ($info) {
            $className = $info['namespace'] . '\\' . $info['class'];
            
            return $this->saveBlock($className);
        }
        
        $this->addLog('Unable to find block namespace for file ' . $path);
        
        return false;
    }
277193
private function setPath($path)
    {
        $this->info['path'] = $this->info['file'] = $this->info['extension'] = $this->info['content'] = null;

        if ($this->getScheme() === 'data') {
            $this->info['content'] = $path;

            return;
        }

        $file = substr(strrchr($path, '/'), 1);

        if (strlen($file)) {
            $path = substr($path, 0, -strlen($file));

            if (preg_match('/(.*)\.([\w]+)$/', $file, $match)) {
                $this->info['file'] = rawurldecode($match[1]);
                $this->info['extension'] = $match[2];
            } else {
                $this->info['file'] = rawurldecode($file);
            }
        }

        $this->info['path'] = [];

        foreach (explode('/', $path) as $dir) {
            $dir = rawurldecode($dir);

            if ($dir !== '') {
                $this->info['path'][] = $dir;
            }
        }
    }