This repository has been archived by the owner on Feb 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e607567
commit 983a9c8
Showing
13 changed files
with
1,887 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
.PHONY: build update validate autoload reset coveralls | ||
|
||
build: update | ||
|
||
update: | ||
@echo "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Update project \033[0m" | ||
@composer update --optimize-autoloader --no-interaction | ||
@echo "" | ||
|
||
validate: | ||
@echo "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Composer validate \033[0m" | ||
@composer validate --no-interaction | ||
@echo "" | ||
|
||
autoload: | ||
@echo "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Composer autoload \033[0m" | ||
@composer dump-autoload --optimize --no-interaction | ||
@echo "" | ||
|
||
reset: | ||
@echo "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Hard reset \033[0m" | ||
@git reset --hard | ||
|
||
clean: | ||
@echo "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Hard reset \033[0m" | ||
@rm -fr ./build | ||
@mkdir -vp ./build | ||
@rm -fr ./vendor | ||
@rm -vf ./composer.lock | ||
|
||
coveralls: | ||
@echo "\033[0;33m>>> >>> >>> >>> >>> >>> >>> >>> \033[0;30;46m Send coverage to coveralls.io \033[0m" | ||
@echo "Process Completed sucessfully" | ||
@echo "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?php | ||
/** | ||
* This class is used for autocomplete. | ||
* Class _AUTOLOAD_ | ||
* @noautoload it avoids to index this class | ||
* @generated by AutoLoadOne 1.11 generated 2019/06/03 12:27:22 | ||
* @copyright Copyright Jorge Castro C - MIT License. https://github.com/EFTEC/AutoLoadOne | ||
* @author Divine Niiquaye <hello@biuhub.net> | ||
*/ | ||
const s5cf4696a6fbdd__debug = true; | ||
|
||
/* @var string[] Where $_arrautoloadCustom['namespace\Class']='folder\file.php' */ | ||
const s5cf4696a6fbdd__arrautoloadCustom = [ | ||
|
||
]; | ||
|
||
/* @var string[] Where $_arrautoload['namespace']='folder' */ | ||
const s5cf4696a6fbdd__arrautoload = [ | ||
'BiuradPHP\Toolbox\FilePHP' => '/src' | ||
]; | ||
|
||
/* @var boolean[] Where $_arrautoload['namespace' or 'namespace\Class']=true if it's absolute (it uses the full path) */ | ||
const s5cf4696a6fbdd__arrautoloadAbsolute = [ | ||
|
||
]; | ||
|
||
/** | ||
* @param $class_name | ||
* @throws Exception | ||
*/ | ||
function s5cf4696a6fbdd__auto($class_name) | ||
{ | ||
// its called only if the class is not loaded. | ||
$ns = dirname($class_name); // without trailing | ||
$ns = ($ns == '.') ? '' : $ns; | ||
$cls = basename($class_name); | ||
// special cases | ||
if (isset(s5cf4696a6fbdd__arrautoloadCustom[$class_name])) { | ||
s5cf4696a6fbdd__loadIfExists(s5cf4696a6fbdd__arrautoloadCustom[$class_name], $class_name); | ||
return; | ||
} | ||
// normal (folder) cases | ||
if (isset(s5cf4696a6fbdd__arrautoload[$ns])) { | ||
s5cf4696a6fbdd__loadIfExists(s5cf4696a6fbdd__arrautoload[$ns] . '/' . $cls . '.php', $ns); | ||
return; | ||
} | ||
} | ||
|
||
/** | ||
* We load the file. | ||
* @param string $filename | ||
* @param string $key key of the class it could be the full class name or only the namespace | ||
* @throws Exception | ||
*/ | ||
function s5cf4696a6fbdd__loadIfExists($filename, $key) | ||
{ | ||
if (isset(s5cf4696a6fbdd__arrautoloadAbsolute[$key])) { | ||
$fullFile = $filename; // its an absolute path | ||
if (strpos($fullFile, '../') === 0) { // Or maybe, not, it's a remote-relative path. | ||
$oldDir = getcwd(); // we copy the current url | ||
chdir(__DIR__); | ||
} | ||
} else { | ||
$fullFile = __DIR__ . "/" . $filename; // its relative to this path | ||
} | ||
if ((@include $fullFile) === false) { | ||
if (s5cf4696a6fbdd__debug) { | ||
throw new Exception("AutoLoadOne Error: Loading file [" . __DIR__ . "/" . $filename . "] for class [" . basename($filename) . "]"); | ||
} else { | ||
throw new Exception("AutoLoadOne Error: No file found."); | ||
} | ||
} else { | ||
if (isset($oldDir)) { | ||
chdir($oldDir); | ||
} | ||
} | ||
} | ||
|
||
spl_autoload_register(function ($class_name) { | ||
s5cf4696a6fbdd__auto($class_name); | ||
}); | ||
// autorun | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "biurad/filephp", | ||
"description": "This file is used to get rid of some discouraged file funtions when it comes to php filesystem.", | ||
"keywords": ["filephp", "php5", "php7", "biurad", "biurad-toolbox", "filesystem"], | ||
"type": "library", | ||
"homepage": "https://biurad.ml", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Divine Niiquaye", | ||
"email": "hello@biuhub.net" | ||
}, | ||
{ | ||
"name": "Biurad Lap Community", | ||
"homepage": "https://biurad.ml/contributors" | ||
} | ||
], | ||
"minimum-stability": "stable", | ||
"config": { | ||
"vendor-dir": "vendor", | ||
"sort-packages": true | ||
}, | ||
"autoload": { | ||
"files": [ | ||
"autoload.php" | ||
] | ||
}, | ||
"require": {}, | ||
"suggest": { | ||
"symfony/finder": "Symfony Finder Component ^4.3, to handle finding files and directories", | ||
"biurad/filesystem": "Biurad Filesystem Toolbox ^1.0, to handle advanced filesystem usage." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Some Text Example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Some Text Example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello World |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Sample|Hi|Hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
|
||
use BiuradPHP\Toolbox\FilePHP\FileHandler; | ||
|
||
require __DIR__.'/../../autoload.php'; | ||
$filehandler = new FileHandler(); | ||
|
||
echo FileHandler::getInstance(__DIR__)->load(); | ||
echo '<br />'; | ||
echo FileHandler::getInstance(__DIR__.'/data/data.txt')->load(); | ||
echo '<br />'; | ||
FileHandler::getInstance(__DIR__.'/data/sample.txt')->replace(['Sample', 'Hi', 'Hello']); | ||
echo FileHandler::getInstance(__DIR__.'/data/sample.txt')->get(); | ||
echo '<br />'; | ||
echo FileHandler::getInstance(__DIR__.'/data/data-1.txt')->get(false); | ||
echo '<br />'; | ||
echo FileHandler::getInstance(__DIR__.'/data.txt')->basename(); | ||
echo '<br />'; | ||
if (FileHandler::getInstance(__DIR__.'/data/data-1.txt')->exists()) { | ||
FileHandler::getInstance(__DIR__)->match_extended('/*'); | ||
echo FileHandler::getInstance(__DIR__.'/data/data-1.txt')->copy(__DIR__.'/../data'); | ||
echo '<br />'; | ||
echo FileHandler::getInstance(__DIR__.'/../data')->delete(); | ||
} | ||
echo '<br />'; | ||
echo FileHandler::getInstance(__DIR__.'/playground')->mkdir(); | ||
echo '<br />'; | ||
echo FileHandler::getInstance(__DIR__.'/playground')->is_empty(); | ||
echo '<br />'; | ||
echo FileHandler::getInstance(__DIR__.'/playground')->remove_dir(); | ||
echo '<br />'; | ||
echo FileHandler::getInstance(__DIR__.'/../../composer.json')->get(true); | ||
echo '<br />'; | ||
echo FileHandler::getInstance(__DIR__.'/../../')->size(); | ||
echo '<br />'; | ||
echo FileHandler::getInstance(__DIR__)->free_space(); | ||
echo '<br />'; | ||
echo FileHandler::getInstance(__DIR__)->total_space(); | ||
echo '<br />'; | ||
echo FileHandler::getInstance(__DIR__)->readable(); | ||
echo '<br />'; | ||
echo FileHandler::getInstance(__DIR__)->writable(); | ||
echo '<br />'; | ||
echo FileHandler::getInstance(__DIR__)->executable(); | ||
echo '<br />'; | ||
echo FileHandler::getInstance(__DIR__.'/data/data-1.txt')->is_file(); | ||
echo '<br /> '; | ||
echo FileHandler::getInstance(__DIR__)->is_dir(); | ||
echo '<br />'; | ||
echo FileHandler::getInstance(__DIR__)->dirname(); | ||
echo '<br />'; | ||
echo FileHandler::getInstance(__DIR__.'/data/data-2.txt')->passthru(); | ||
echo '<br />'; | ||
echo FileHandler::getInstance(__DIR__.'/data/data-1.txt')->permission(); | ||
echo '<br />'; | ||
echo FileHandler::getInstance(__DIR__.'/data/data.txt')->rename('data.txt'); | ||
echo '<br />'; | ||
echo FileHandler::getInstance(__DIR__.'/data/data-1.txt')->readfile(); | ||
echo '<br />'; | ||
echo FileHandler::getInstance(__DIR__.'/data/data-1.txt')->short_name(); | ||
echo '<br />'; | ||
echo FileHandler::getInstance(__DIR__.'/../../')->count_dir(); | ||
echo '<br />'; | ||
echo FileHandler::getInstance(__DIR__.'/data/data-1.txt')->open(); | ||
echo '<br />'; | ||
$microtime = microtime(true); | ||
$time = 0; | ||
echo round(($microtime - $time) * 1000) / 1000; | ||
//echo FileHandler::getInstance(__DIR__.'/data')->scan_dir(); | ||
echo '<br />'; | ||
//echo FileHandler::getInstance(__DIR__.'/example.php')->file(); | ||
echo '<br />'; | ||
//echo FileHandler::getInstance(__DIR__)->info(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This is a sample text |
Oops, something went wrong.