Check the location of the file.

@return bool
428474
private function isLocalFile()
    {
        try {
            if (file_exists(storage_path('app/'.$this->location))) {
                return true;
            }
        } catch (Exception $e) {
            Log::debug('Could not find the image');

            return false;
        }

        return false;
    }
603087
public function check()
    {
        if ($this->path[0] == '/') {
            $filename = $this->path;
        } else {
            $filename = BASE_PATH . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $this->path);
        }

        if (file_exists($filename)) {
            $isWriteable = is_writeable($filename);
        } else {
            $isWriteable = is_writeable(dirname($filename));
        }

        if (!$isWriteable) {
            if (function_exists('posix_getgroups')) {
                $userID = posix_geteuid();
                $user = posix_getpwuid($userID);

                $currentOwnerID = fileowner(file_exists($filename) ? $filename : dirname($filename));
                $currentOwner = posix_getpwuid($currentOwnerID);

                $message = "User '$user[name]' needs to be able to write to this file:\n$filename\n\nThe file is "
                    . "currently owned by '$currentOwner[name]'.  ";

                if ($user['name'] == $currentOwner['name']) {
                    $message .= 'We recommend that you make the file writeable.';
                } else {
                    $groups = posix_getgroups();
                    $groupList = [];
                    foreach ($groups as $group) {
                        $groupInfo = posix_getgrgid($group);
                        if (in_array($currentOwner['name'], $groupInfo['members'])) {
                            $groupList[] = $groupInfo['name'];
                        }
                    }
                    if ($groupList) {
                        $message .= "	We recommend that you make the file group-writeable and change the group to "
                            . "one of these groups:\n - " . implode("\n - ", $groupList)
                            . "\n\nFor example:\nchmod g+w $filename\nchgrp " . $groupList[0] . " $filename";
                    } else {
                        $message .= "  There is no user-group that contains both the web-server user and the owner "
                            . "of this file.  Change the ownership of the file, create a new group, or temporarily "
                            . "make the file writeable by everyone during the install process.";
                    }
                }
            } else {
                $message = "The webserver user needs to be able to write to this file:\n$filename";
            }

            return [EnvironmentCheck::ERROR, $message];
        }

        return [EnvironmentCheck::OK, ''];
    }
1307401
protected function fileGetContentsCheck()
    {
        $contents = file_get_contents($this->endPoint);
        $contents = $this->cleanUp($contents);

        if ($contents === '[OK]') {
            return true;
        }

        return false;
    }
717396
public function hasFile()
    {
        foreach ($this->fields() as $field) {
            if ($field instanceof Field\File) {
                return true;
            }
        }

        return false;
    }
802257
protected function isADirectory()
    {
        if (file_exists($this->path) && !is_dir($this->path)) {
            throw new  LocationIsADirectory(
                $this->getPath() .' already exists but is not a directory!',
                self::WRITABLE_IS_NOT_A_DIR_ERROR
            );
        }
        return true;
    }
799585
protected function matchLocation()
    {
        return ReplyRuleKeyword::find()
            ->andFilterWhere(['type' => [ReplyRuleKeyword::TYPE_LOCATION]])
            ->wechatRule($this->getWechat()->id)
            ->limitTime(TIMESTAMP)
            ->all();
    }
211776
public function filectime()
	{
		if ($this->use_include_path) {
			return filectime(stream_resolve_include_path($this->_fhandle));
		} else {
			return filectime($this->_fhandle);
		}
	}
527852
public function dir_readdir() {
    // Current file list will be null if there was a rewind.
    if (is_null($this->current_file_list)) {
      if (!$this->fillFileBuffer()) {
        return false;
      }
    } else if (empty($this->current_file_list)) {
      // If there is no next marker, or we cannot fill the buffer, we are done.
      if (!isset($this->next_marker) || !$this->fillFileBuffer()) {
        return false;
      }
    }

    // The file list might be empty if out next_marker was actually the last
    // file in the list.
    if (empty($this->current_file_list)) {
      return false;
    } else {
      return array_shift($this->current_file_list);
    }
  }
315663
public function checkPaths(): self
    {
        if (empty($this->options['rootDir'])) {
            $this->options['rootDir'] .= '/';
        } else {
            $rootDirPosLastChar = strlen($this->options['rootDir']) - 1;
            
            if ($this->options['rootDir'][$rootDirPosLastChar] !== '/') {
                $this->options['rootDir'] .= '/';
            }
        }
        
        if (empty($this->options['vendorDir'])) {
            $this->options['vendorDir'] .= '/';
        } else {
            $vendorDirPosLastChar = strlen($this->options['vendorDir']) - 1;
            
            if ($this->options['vendorDir'][$vendorDirPosLastChar] !== '/') {
                $this->options['vendorDir'] .= '/';
            }
        }
        
        return $this;
    }
89487
public function fileatime()
	{
		if ($this->use_include_path) {
			return fileatime(stream_resolve_include_path($this->_fhandle));
		} else {
			return fileatime($this->_fhandle);
		}
	}
683690
public function isLocal()
    {
        if($this->hasValidResource()) {
            return stream_is_local($this->resource);
        }
        if ($url = $this->url()) {
            return stream_is_local("$url");
        }
        return false;
    }
806154
public function getLocation()
        {
            return isset($this->_data[self::PROFILE][self::LOCATION]) ? $this->_data[self::PROFILE][self::LOCATION] : null;
        }
577361
protected function positionOfToc() {

		$search = array_keys( $this->manifest );

		if ( false === $this->frontMatterLastPos ) {

			$array_pos = array_search( 'copyright', $search, true );
			if ( false === $array_pos ) {
				$array_pos = -1;
			}
		} else {

			$array_pos = -1;
			$preg = '/^front-matter-' . sprintf( '%03s', $this->frontMatterLastPos ) . '$/';
			foreach ( $search as $key => $val ) {
				if ( preg_match( $preg, $val ) ) {
					$array_pos = $key;
					break;
				}
			}
		}

		return $array_pos;
	}
355402
public function getPos()
    {
        if ($this->_mode == 0) {
            if (feof($this->file)) {
                $stat = fstat($this->file);
                fseek($this->file, $stat['size']);
            }

            $pos = ftell($this->file);

            return $pos;
        } else {
            return 0;
        }
    }
1277889
private function determine()
	{

		if (false !== $this->filepath && true === is_readable($this->filepath . '/' . $this->filename)) {
			return strtolower(trim(file_get_contents($this->filepath . '/' . $this->filename)));
		} elseif (null !== getenv($this->variable)) {
			return getenv($this->variable);
		} else {
			return false;
		}
	}
1247480
private function findOffset()
    {
        $this->seek(0);

        $offset = 0;

        while (!$this->isEndOfFile()) {
            if (strtolower($this->read(1)) === self::$sequence[$offset]) {
                $offset++;
            } else {
                $offset = 0;
            }

            if (!isset(self::$sequence[$offset + 1])) {
                break;
            }
        }

        $this->seek(1, SEEK_CUR);

        if ($offset === (count(self::$sequence) - 1)) {
            $position = $this->getPosition();

            if ("\r\n" === $this->read(2)) {
                return $position + 2;
            }

            return $position;
        }

        return null;
    }
141544
public function check()
    {

        $config = $this->getConfig();

        if (isset($config['ext'])) {
            $this->setExt($config['ext']);
        }

        if (isset($config['folder'])) {

            $folder = $config['folder'];
            $this->setFolder($folder);


            if(!$this->getFileSystem()->exists($folder))
            {
                $this->getFileSystem()->createDir($folder);
                chmod($folder, 0777);
            }
        }else{

            return false;
        }

        // we have do something else

        if (function_exists('gzcompress') && function_exists('gzuncompress')) {
            return true;
        }
    }