Refactor
This commit is contained in:
parent
02e34365a5
commit
03196c3e53
4 changed files with 46 additions and 30 deletions
|
@ -4,6 +4,7 @@
|
|||
},
|
||||
"require": {
|
||||
"embed/embed": "^4.3",
|
||||
"laminas/laminas-diactoros": "^2.8"
|
||||
"laminas/laminas-diactoros": "^2.8",
|
||||
"grandel/include-directory": "^0.2.2"
|
||||
}
|
||||
}
|
||||
|
|
44
composer.lock
generated
44
composer.lock
generated
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "72ca4d25f90c6bffc18b886e1ef67acb",
|
||||
"content-hash": "3b4fa12289437129c7113dbe40a6bb96",
|
||||
"packages": [
|
||||
{
|
||||
"name": "composer/ca-bundle",
|
||||
|
@ -157,6 +157,46 @@
|
|||
},
|
||||
"time": "2021-10-10T17:10:44+00:00"
|
||||
},
|
||||
{
|
||||
"name": "grandel/include-directory",
|
||||
"version": "v0.2.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/grandeljay/include-directory.git",
|
||||
"reference": "a5c830e8f1527c818b521ab18f2accecb02f9919"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/grandeljay/include-directory/zipball/a5c830e8f1527c818b521ab18f2accecb02f9919",
|
||||
"reference": "a5c830e8f1527c818b521ab18f2accecb02f9919",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.4"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Grandel\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"AGPL-3.0-or-later"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jay Trees",
|
||||
"email": "github.jay@grandel.anonaddy.me"
|
||||
}
|
||||
],
|
||||
"description": "Automatically include all files in a given directory.",
|
||||
"support": {
|
||||
"issues": "https://github.com/grandeljay/include-directory/issues",
|
||||
"source": "https://github.com/grandeljay/include-directory/tree/v0.2.2"
|
||||
},
|
||||
"time": "2021-12-01T14:10:17+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laminas/laminas-diactoros",
|
||||
"version": "2.8.0",
|
||||
|
@ -709,5 +749,5 @@
|
|||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.1.0"
|
||||
"plugin-api-version": "2.0.0"
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* auto-include.php
|
||||
*
|
||||
* Includes all *.php files in a given directory (including sub directories).
|
||||
*
|
||||
* @param string $directoryToInclude The absolute directory to include.
|
||||
*
|
||||
* @author Jay Trees <github.jay@grandel.anonaddy.me>
|
||||
*/
|
||||
|
||||
function autoInclude(string $directoryToInclude)
|
||||
{
|
||||
foreach (scandir($directoryToInclude) as $filename) {
|
||||
$filepath = str_replace('\\', '/', $directoryToInclude . '/' . $filename);
|
||||
$filepathThis = str_replace('\\', '/', __FILE__);
|
||||
|
||||
if (is_file($filepath) && $filepathThis !== $filepath) {
|
||||
require $filepath;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,12 +9,10 @@
|
|||
/**
|
||||
* Include
|
||||
*/
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
require 'includes/functions/auto-include.php';
|
||||
|
||||
autoInclude(__DIR__ . '/includes/classes');
|
||||
autoInclude(__DIR__ . '/includes/functions');
|
||||
$include = new Grandel\IncludeDirectory(__DIR__ . '/includes/classes');
|
||||
$include = new Grandel\IncludeDirectory(__DIR__ . '/includes/functions');
|
||||
|
||||
/**
|
||||
* Config
|
||||
|
|
Loading…
Reference in a new issue