Asserts that the given path is executable.

@param string $path The path to check that must be executable.
@param Throwable $exception The exception to throw if the assertion fails.
@return string The path if the assertion does not fail.
352951
public static function assertIsExecutable(string $path, Throwable $exception): string
    {
        static::makeAssertion(\is_executable($path), $exception);
        return $path;
    }
187875
function isExecutable(string $file): bool {
    $fileInfo = new \SplFileInfo($file);
    if (!$fileInfo->isFile()) return false;
    if ($fileInfo->isExecutable()) return true;
    return static::isWindows() ? $this->checkFileExtension($fileInfo) : $this->checkFilePermissions($fileInfo);
  }
45749
private function verify(string $path)
  {
    if (!is_dir($this->cacheDirectory))
      mkdir($this->cacheDirectory, 0777, true);

      if (!is_dir($this->cacheDirectory)) {
        return $this->exception(
          'Caching directory "' . $this->cacheDirectory . '" does not exist.'
        );
      }

    if (!is_dir($this->viewsDirectory))
      return $this->exception(
        'Views directory "' . $this->viewsDirectory . '" does not exist.'
      );

    if (!file_exists($path))
      return $this->exception(
        'View file "' . $path . '" does not exist.'
      );
  }
1191429
public function assertAbsent($path)
    {
        if ($this->getConfig('disable_asserts', false) === false && $this->has($path)) {
            throw new FileExistsException($path);
        }
    }
1122689
public function evaluateSource($path)
    {
        ob_start();

        extract($this->getData(), EXTR_SKIP);
        include $path;
        if(!$result = ob_get_clean()) {
            throw new \RuntimeException(sprintf('The template "%s" cannot be evaluated.', $path));
        }

        return $result;
    }
365613
public static function assertEquals($actual, $expected, Throwable $exception)
    {
        static::makeAssertion($actual === $expected, $exception);
        return $actual;
    }
740724
public static function isFile(string $path) : bool
    {
        try {
            return ErrorCatcher::run(static function() use ($path) {
                return is_file($path);
            });
        } catch (\ErrorException $e) {
            throw new IoException('Error checking if ' . $path . ' is a file', 0, $e);
        }
    }
1286106
public static function assertIsCallable($variable, Throwable $exception): bool
    {
        static::makeAssertion(\is_callable($variable), $exception);
        return true;
    }
1213350
public static function assertIsNotString($variable, Throwable $exception): bool
    {
        static::makeAssertion(!\is_string($variable), $exception);
        return true;
    }
1273136
private function validateExcludeRegex(string $path): bool
    {
        $excludeRegex = $this->config->getExcludeRegex();
        return $excludeRegex === null || Validator::regex($excludeRegex)->validate($path) !== true;
    }
106085
public function assertAbsent($path)
    {
        if ($this->config->get('disable_asserts', false) === false && $this->has($path)) {
            throw new FileExistsException($path);
        }
    }
313827
protected function checkPath( $path ) {
		$iterator = new RecursiveIteratorIterator(
			new RecursiveCallbackFilterIterator(
				new RecursiveDirectoryIterator( $path ),
				[ $this, 'filterDirs' ]
			)
		);
		$bad = [];
		/** @var SplFileInfo $file */
		foreach ( $iterator as $file ) {
			// Skip directories
			if ( !$file->isFile() ) {
				continue;
			}

			// Skip whitelisted files
			if ( in_array( $file->getPathname(), $this->ignoredFiles ) ) {
				$this->progress( 'S' );
				continue;
			}

			if ( !$file->isExecutable() ) {
				$this->progress( '.' );
				continue;
			}

			if ( !$this->checkFile( $file ) ) {
				$this->progress( 'E' );
				$bad[] = $file;
			} else {
				$this->progress( '.' );
			}
		}

		return $bad;
	}
1274360
public function getExceptionFile(\Throwable $exception): string
    {
        $data = [];
        while ($exception) {
            $data[] = [
                \get_class($exception),
                $exception->getMessage(),
                $exception->getCode(),
                $exception->getFile(),
                $exception->getLine(),
                \array_map(function ($item) {
                    unset($item['args']);

                    return $item;
                }, $exception->getTrace()),
            ];
            $exception = $exception->getPrevious();
        }

        $hash = \substr(\md5(\serialize($data)), 0, 10);
        $dir = \strtr($this->directory . '/', '\\/', DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR);
        foreach (new \DirectoryIterator($this->directory) as $file) {
            if (\strpos($file->getBasename(), $hash)) {
                return $dir . $file;
            }
        }

        return $dir . 'exception--' . \date('Y-m-d--H-i') . "--$hash.html";
    }
592385
public function setPath($path)
        {
            if (realpath($path) === false) {
                throw new Exception("Path must be absolute.");
            }

            $this->_path = realpath($path) . DS;
            return $this;
        }
753188
public function getFilePath( string$filePath, string$path=null ):string
	{
		if( !isset($this->basePath) )
			{ throw new \Exception('BasePath musbe set.'); }

		if( !strlen($filePath) )
			{ throw new \Exception('FilePath cannot be empty.'); }

		if( '/'===$filePath{0} ){
			if( is_null($path) )
				{ return $filePath; }
			else
				{ return $this->basePath.$filePath; }
		}else{
			if( !strlen($path) )
				{ return $this->basePath.'/'.$filePath; }
			elseif( '/'===substr($path,-1) )
				{ return $path.$filePath; }
			else
				{ return $path.'/'.$filePath; }
		}

	}
155122
public function checkPath($path = null)
  {
    if($path === null)
    {
      $path = $this->path;
    }

    if(strlen($path) == 0)
    {
      return TRUE;
    }

    $pattern = "/^" . $this->regex["path"] . "$/";
    $status = @preg_match($pattern, $path);

    if($status === FALSE)
    {
      throw new Exception("URI path validation failed");
    }

    return ($status == 1);
  }
1125543
public function rm( $path )
	{
		try {
			$this->fs->delete( $path );
		} catch( \Exception $e ) {
			throw new Exception( $e->getMessage(), 0, $e );
		}
	}