1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-09 06:36:52 +02:00

refactor(core): Remove App from all core namespaces #469

This commit is contained in:
Awilum
2020-09-02 19:52:35 +03:00
parent 66f5ae46b4
commit 54b5532de1
41 changed files with 43 additions and 42 deletions

View File

@@ -7,7 +7,7 @@ declare(strict_types=1);
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
namespace Flextype\App\Foundation;
namespace Flextype\Foundation;
use function count;
use function implode;

View File

@@ -7,7 +7,7 @@ declare(strict_types=1);
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
namespace Flextype\App\Foundation\Entries;
namespace Flextype\Foundation\Entries;
use Flextype\Component\Filesystem\Filesystem;
use function array_merge;
@@ -36,7 +36,7 @@ class Entries
* @var array
* @access private
*/
private $entry = [];
public $entry = [];
/**
* Current entry create data array

View File

@@ -9,6 +9,7 @@ declare(strict_types=1);
if (flextype('registry')->get('flextype.settings.entries.fields.slug.enabled')) {
flextype('emitter')->addListener('onEntryAfterInitialized', static function () : void {
$parts = explode('/', ltrim(rtrim(flextype('entries')->entry_id, '/'), '/'));
flextype('entries')->entry['slug'] = isset(flextype('entries')->entry['slug']) ? (string) flextype('entries')->entry['slug'] : (string) end($parts);
});

View File

@@ -7,7 +7,7 @@ declare(strict_types=1);
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
namespace Flextype\App\Foundation;
namespace Flextype\Foundation;
use Slim\App;

View File

@@ -7,7 +7,7 @@ declare(strict_types=1);
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
namespace Flextype\App\Foundation\Media;
namespace Flextype\Foundation\Media;
use Flextype\Component\Filesystem\Filesystem;
use Intervention\Image\ImageManagerStatic as Image;

View File

@@ -7,7 +7,7 @@ declare(strict_types=1);
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
namespace Flextype\App\Foundation\Media;
namespace Flextype\Foundation\Media;
use Flextype\Component\Arrays\Arrays;
use Flextype\Component\Filesystem\Filesystem;

View File

@@ -7,7 +7,7 @@ declare(strict_types=1);
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
namespace Flextype\App\Foundation\Media;
namespace Flextype\Foundation\Media;
use Flextype\Component\Filesystem\Filesystem;
use Slim\Http\Environment;

View File

@@ -7,7 +7,7 @@ declare(strict_types=1);
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
namespace Flextype\App\Foundation\Media;
namespace Flextype\Foundation\Media;
class MediaFoldersMeta
{

View File

@@ -7,7 +7,7 @@ declare(strict_types=1);
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
namespace Flextype\App\Foundation;
namespace Flextype\Foundation;
use Composer\Semver\Semver;
use Flextype\Component\Arrays\Arrays;

View File

@@ -7,7 +7,7 @@ declare(strict_types=1);
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
namespace Flextype\App\Support;
namespace Flextype\Support;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Criteria;

View File

@@ -7,7 +7,7 @@ declare(strict_types=1);
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
use Flextype\App\Support\Collection;
use Flextype\Support\Collection;
if (! function_exists('collect')) {
/**

View File

@@ -7,7 +7,7 @@ declare(strict_types=1);
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
use Flextype\App\Foundation\Flextype;
use Flextype\Foundation\Flextype;
if (! function_exists('flextype')) {
/**

View File

@@ -7,7 +7,7 @@ declare(strict_types=1);
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
namespace Flextype\App\Support\Parsers;
namespace Flextype\Support\Parsers;
use function md5;

View File

@@ -7,7 +7,7 @@ declare(strict_types=1);
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
namespace Flextype\App\Support\Parsers;
namespace Flextype\Support\Parsers;
use function md5;

View File

@@ -7,7 +7,7 @@ declare(strict_types=1);
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
namespace Flextype\App\Support\Serializers;
namespace Flextype\Support\Serializers;
use Flextype\Component\Arrays\Arrays;
use function array_slice;

View File

@@ -7,7 +7,7 @@ declare(strict_types=1);
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
namespace Flextype\App\Support\Serializers;
namespace Flextype\Support\Serializers;
use RuntimeException;
use function defined;

View File

@@ -7,7 +7,7 @@ declare(strict_types=1);
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
namespace Flextype\App\Support\Serializers;
namespace Flextype\Support\Serializers;
use RuntimeException;
use Symfony\Component\Yaml\Exception\DumpException as SymfonyYamlDumpException;

View File

@@ -9,7 +9,7 @@ declare(strict_types=1);
namespace Flextype;
use Flextype\App\Foundation\Flextype;
use Flextype\Foundation\Flextype;
use Flextype\Component\Registry\Registry;
use Flextype\Component\Session\Session;
use Zeuxisoo\Whoops\Provider\Slim\WhoopsMiddleware;
@@ -64,13 +64,13 @@ include_once 'dependencies.php';
/**
* Include API ENDPOINTS
*/
include_once ROOT_DIR . '/src/flextype/app/Endpoints/Utils/errors.php';
include_once ROOT_DIR . '/src/flextype/app/Endpoints/Utils/access.php';
include_once ROOT_DIR . '/src/flextype/app/Endpoints/entries.php';
include_once ROOT_DIR . '/src/flextype/app/Endpoints/registry.php';
include_once ROOT_DIR . '/src/flextype/app/Endpoints/files.php';
include_once ROOT_DIR . '/src/flextype/app/Endpoints/folders.php';
include_once ROOT_DIR . '/src/flextype/app/Endpoints/images.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/Utils/errors.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/Utils/access.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/entries.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/registry.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/files.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/folders.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/images.php';
/**
* Set internal encoding
@@ -100,12 +100,12 @@ date_default_timezone_set(flextype('registry')->get('flextype.settings.timezone'
/**
* Init shortocodes
*
* Load Flextype Shortcodes from directory /flextype/app/Support/Parsers/Shortcodes/ based on flextype.settings.shortcode.shortcodes array
* Load Flextype Shortcodes from directory /flextype/Support/Parsers/Shortcodes/ based on flextype.settings.shortcode.shortcodes array
*/
$shortcodes = flextype('registry')->get('flextype.settings.shortcode.shortcodes');
foreach ($shortcodes as $shortcode_name => $shortcode) {
$shortcode_file_path = ROOT_DIR . '/src/flextype/app/Support/Parsers/Shortcodes/' . str_replace('_', '', ucwords($shortcode_name, '_')) . 'Shortcode.php';
$shortcode_file_path = ROOT_DIR . '/src/flextype/Support/Parsers/Shortcodes/' . str_replace('_', '', ucwords($shortcode_name, '_')) . 'Shortcode.php';
if (! file_exists($shortcode_file_path)) {
continue;
}
@@ -116,16 +116,16 @@ foreach ($shortcodes as $shortcode_name => $shortcode) {
/**
* Init entries fields
*
* Load Flextype Entries fields from directory /flextype/app/Foundation/Entries/Fields/ based on flextype.settings.entries.fields array
* Load Flextype Entries fields from directory /flextype/Foundation/Entries/Fields/ based on flextype.settings.entries.fields array
*/
$entry_fields = flextype('registry')->get('flextype.settings.entries.fields');
foreach ($entry_fields as $field_name => $field) {
$entry_field_file_path = ROOT_DIR . '/src/flextype/app/Foundation/Entries/Fields/' . str_replace('_', '', ucwords($field_name, '_')) . 'Field.php';
$entry_field_file_path = ROOT_DIR . '/src/flextype/Foundation/Entries/Fields/' . str_replace('_', '', ucwords($field_name, '_')) . 'Field.php';
if (! file_exists($entry_field_file_path)) {
continue;
}
include_once $entry_field_file_path;
}

View File

@@ -12,18 +12,18 @@ namespace Flextype;
use Bnf\Slim3Psr15\CallableResolver;
use Cocur\Slugify\Slugify;
use Flextype\Component\Strings\Strings;
use Flextype\App\Foundation\Cors;
use Flextype\App\Foundation\Entries\Entries;
use Flextype\App\Foundation\Media\MediaFiles;
use Flextype\App\Foundation\Media\MediaFilesMeta;
use Flextype\App\Foundation\Media\MediaFolders;
use Flextype\App\Foundation\Media\MediaFoldersMeta;
use Flextype\App\Foundation\Plugins;
use Flextype\App\Support\Parsers\Markdown;
use Flextype\App\Support\Parsers\Shortcode;
use Flextype\App\Support\Serializers\Frontmatter;
use Flextype\App\Support\Serializers\Json;
use Flextype\App\Support\Serializers\Yaml;
use Flextype\Foundation\Cors;
use Flextype\Foundation\Entries\Entries;
use Flextype\Foundation\Media\MediaFiles;
use Flextype\Foundation\Media\MediaFilesMeta;
use Flextype\Foundation\Media\MediaFolders;
use Flextype\Foundation\Media\MediaFoldersMeta;
use Flextype\Foundation\Plugins;
use Flextype\Support\Parsers\Markdown;
use Flextype\Support\Parsers\Shortcode;
use Flextype\Support\Serializers\Frontmatter;
use Flextype\Support\Serializers\Json;
use Flextype\Support\Serializers\Yaml;
use Intervention\Image\ImageManager;
use League\Event\Emitter;
use League\Flysystem\Adapter\Local;