2 Commits
3.7.0 ... 4.0.1

4 changed files with 7 additions and 70 deletions

1
.gitignore vendored
View File

@@ -1,4 +1,3 @@
!.gitignore
composer.phar
composer.lock
vendor

View File

@@ -41,8 +41,8 @@ final class index extends core
*/
public function index(): null
{
if (str_contains($$this->request->headers['accept'], content::any->value)) {
// Request for any response
if (str_contains($$this->request->headers['accept'] ?? '', content::html->value)) {
// Request for HTML response
// Render page
$$page = $$this->view->render('index.html');

View File

@@ -1,66 +0,0 @@
<?php
declare(strict_types=1);
namespace ${REPO_OWNER}\${REPO_NAME}\models\traits;
// Built-in libraries
use exception;
/**
* Files
*
* Trait with files handlers
*
* @method static void delete(string $$directory, array &$$errors)
*
* @package ${REPO_OWNER}\${REPO_NAME}\models\traits
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
*/
trait files
{
/**
* Delete
*
* Delete files recursively
*
* @param string $$directory Directory
* @param array &$$errors Registry of errors
*
* @return void
*/
private static function delete(string $$directory, array &$$errors = []): void
{
try {
if (file_exists($$directory)) {
// Directory exists
// Deleting descendant files and directories (enter to the recursion)
foreach (scandir($$directory) as $$file) {
if ($$file === '.' || $$file === '..') continue;
else if (is_dir("$$directory/$$file")) static::delete("$$directory/$$file", $$errors);
else unlink("$$directory/$$file");
}
// Deleting the directory
rmdir($$directory);
// Exit (success)
return;
} else throw new exception('Directory does not exist');
} catch (exception $$e) {
// Writing to the registry of errors
$$errors[] = [
'text' => $$e->getMessage(),
'file' => $$e->getFile(),
'line' => $$e->getLine(),
'stack' => $$e->getTrace()
];
}
// Exit (fail)
return;
}
}

View File

@@ -26,11 +26,15 @@
"mirzaev/minimal": "^3.7",
"mirzaev/baza": "^3.3",
"mirzaev/languages": "^1",
"mirzaev/currencies": "^1",
"twig/twig": "^3.2",
"twig/extra-bundle": "^3.7",
"twig/intl-extra": "^3.10"
},
"suggest": {
"mirzaev/files": "Easy working with files",
"mirzaev/currencies": "Easy currencies integration"
},
"autoload": {
"psr-4": {
"${REPO_OWNER}\\${REPO_NAME}\\": "${REPO_OWNER}/${REPO_NAME}/system"