/** * Checks to see if a page is cached * * @param $page * * @return bool */ public function IsCached($page) { $path = PathFinder::Path("Cache/{$page}"); if (FileOperations::FileExists($path)) { return true; } return false; }
public static function OverWrite($location, $contents) { $path = PathFinder::Path($location); if ($path == null) { return null; } file_put_contents($path, $contents); }
<?php require_once "vendor/autoload.php"; use PHPTools\FileMethods; use PHPTools\PathFinder; use PHPTools\JsonReader; /** * Path will ALWAYS be relative to your source folder. It is REQUIRED you create the file Json/resource/secret.json under these respective directories * for path finder to work! * * PathFinder uses this secret json file to correctly scope to your current working environment! */ if (FileMethods::FileExists(PathFinder::Path("String.php"))) { echo "The String file is present!"; } /** * Some functions do not require you to use PathFinder as it is already build into the method */ $file = JsonReader::PathRead('my_json.json'); if ($file != null) { echo $file; } /** * Here is a full list of methods which have PathFinder built into them * * JsonReader::PathRead('my_file.json'); * JsonWriter::PathWrite('my_file.json', "hello" ); * * I plan on updating and cleaning the tools in the future, but due to how I developed it, PathFinder was a late addition in regards * to the rest of these classes. */