mirror of
https://github.com/flextype/flextype.git
synced 2025-08-10 15:14:20 +02:00
feat(core): Flextype Solid Core - next round #458
This commit is contained in:
@@ -18,7 +18,7 @@ class AcpuCacheAdapter implements CacheAdapterInterface
|
||||
|
||||
public function __construct(ContainerInterface $flextype)
|
||||
{
|
||||
$this->container = $flextype;
|
||||
$this->flextype = $flextype;
|
||||
}
|
||||
|
||||
public function getDriver() : object
|
||||
|
@@ -18,7 +18,7 @@ class ArrayCacheAdapter implements CacheAdapterInterface
|
||||
|
||||
public function __construct(ContainerInterface $flextype)
|
||||
{
|
||||
$this->container = $flextype;
|
||||
$this->flextype = $flextype;
|
||||
}
|
||||
|
||||
public function getDriver() : object
|
||||
|
@@ -58,7 +58,7 @@ class Cache
|
||||
*/
|
||||
public function __construct($flextype)
|
||||
{
|
||||
$this->container = $flextype;
|
||||
$this->flextype = $flextype;
|
||||
|
||||
// Create Cache Directory
|
||||
! Filesystem::has(PATH['cache']) and Filesystem::createDir(PATH['cache']);
|
||||
@@ -85,7 +85,7 @@ class Cache
|
||||
*/
|
||||
public function getCacheDriver() : object
|
||||
{
|
||||
return $this->container['cache_adapter']->getDriver();
|
||||
return $this->flextype->container('cache_adapter')->getDriver();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -325,7 +325,7 @@ class Cache
|
||||
public function purge(string $directory) : void
|
||||
{
|
||||
// Run event: onCacheBeforePurge
|
||||
$this->container['emitter']->emit('onCacheBeforePurge');
|
||||
$this->flextype['emitter']->emit('onCacheBeforePurge');
|
||||
|
||||
// Remove specific cache directory
|
||||
Filesystem::deleteDir(PATH['cache'] . '/' . $directory);
|
||||
@@ -344,7 +344,7 @@ class Cache
|
||||
error_reporting($errorReporting);
|
||||
|
||||
// Run event: onCacheAfterPurge
|
||||
$this->container['emitter']->emit('onCacheAfterPurge');
|
||||
$this->flextype['emitter']->emit('onCacheAfterPurge');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -357,7 +357,7 @@ class Cache
|
||||
public function purgeAll() : void
|
||||
{
|
||||
// Run event: onCacheAfterPurgeAll
|
||||
$this->container['emitter']->emit('onCacheAfterPurgeAll');
|
||||
$this->flextype['emitter']->emit('onCacheAfterPurgeAll');
|
||||
|
||||
// Remove cache directory
|
||||
Filesystem::deleteDir(PATH['cache']);
|
||||
@@ -376,6 +376,6 @@ class Cache
|
||||
error_reporting($errorReporting);
|
||||
|
||||
// Run event: onCacheAfterPurgeAll
|
||||
$this->container['emitter']->emit('onCacheAfterPurgeAll');
|
||||
$this->flextype['emitter']->emit('onCacheAfterPurgeAll');
|
||||
}
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@ class FilesystemCacheAdapter implements CacheAdapterInterface
|
||||
|
||||
public function __construct(ContainerInterface $flextype)
|
||||
{
|
||||
$this->container = $flextype;
|
||||
$this->flextype = $flextype;
|
||||
}
|
||||
|
||||
public function getDriver() : object
|
||||
|
@@ -19,7 +19,7 @@ class MemcachedCacheAdapter implements CacheAdapterInterface
|
||||
|
||||
public function __construct(ContainerInterface $flextype)
|
||||
{
|
||||
$this->container = $flextype;
|
||||
$this->flextype = $flextype;
|
||||
}
|
||||
|
||||
public function getDriver() : object
|
||||
|
@@ -18,7 +18,7 @@ class PhpArrayFileCacheAdapter implements CacheAdapterInterface
|
||||
|
||||
public function __construct(ContainerInterface $flextype)
|
||||
{
|
||||
$this->container = $flextype;
|
||||
$this->flextype = $flextype;
|
||||
}
|
||||
|
||||
public function getDriver() : object
|
||||
|
@@ -19,7 +19,7 @@ class PhpFileCacheAdapter implements CacheAdapterInterface
|
||||
|
||||
public function __construct(ContainerInterface $flextype)
|
||||
{
|
||||
$this->container = $flextype;
|
||||
$this->flextype = $flextype;
|
||||
}
|
||||
|
||||
public function getDriver() : object
|
||||
|
@@ -20,7 +20,7 @@ class RedisCacheAdapter implements CacheAdapterInterface
|
||||
|
||||
public function __construct(ContainerInterface $flextype)
|
||||
{
|
||||
$this->container = $flextype;
|
||||
$this->flextype = $flextype;
|
||||
}
|
||||
|
||||
public function getDriver() : object
|
||||
|
@@ -20,7 +20,7 @@ class SQLite3CacheAdapter implements CacheAdapterInterface
|
||||
|
||||
public function __construct(ContainerInterface $flextype)
|
||||
{
|
||||
$this->container = $flextype;
|
||||
$this->flextype = $flextype;
|
||||
}
|
||||
|
||||
public function getDriver() : object
|
||||
|
@@ -18,7 +18,7 @@ class WinCacheCacheAdapter implements CacheAdapterInterface
|
||||
|
||||
public function __construct(ContainerInterface $flextype)
|
||||
{
|
||||
$this->container = $flextype;
|
||||
$this->flextype = $flextype;
|
||||
}
|
||||
|
||||
public function getDriver() : object
|
||||
|
@@ -18,7 +18,7 @@ class ZendDataCacheCacheAdapter implements CacheAdapterInterface
|
||||
|
||||
public function __construct(ContainerInterface $flextype)
|
||||
{
|
||||
$this->container = $flextype;
|
||||
$this->flextype = $flextype;
|
||||
}
|
||||
|
||||
public function getDriver() : object
|
||||
|
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Flextype (https://flextype.org)
|
||||
* Founded by Sergey Romanenko and maintained by Flextype Community.
|
||||
*/
|
||||
|
||||
namespace Flextype\App\Foundation;
|
||||
|
||||
class Container
|
||||
{
|
||||
/**
|
||||
* Application
|
||||
*/
|
||||
protected $flextype;
|
||||
|
||||
/**
|
||||
* __construct
|
||||
*/
|
||||
public function __construct($flextype)
|
||||
{
|
||||
$this->container = $flextype;
|
||||
}
|
||||
|
||||
/**
|
||||
* __get
|
||||
*/
|
||||
public function __get($property)
|
||||
{
|
||||
if ($this->container->{$property}) {
|
||||
return $this->container->{$property};
|
||||
}
|
||||
}
|
||||
}
|
@@ -194,7 +194,7 @@ class Entries
|
||||
// Fetch single entry.
|
||||
if (count($entries_list) > 0) {
|
||||
foreach ($entries_list as $current_entry) {
|
||||
if ($current_entry->getType() === 'file' && $current_entry->getFilename() === 'entry' . '.' . $this->container->registry->get('flextype.settings.entries.extension')) {
|
||||
if ($current_entry->getType() === 'file' && $current_entry->getFilename() === 'entry' . '.' . $this->flextype->registry->get('flextype.settings.entries.extension')) {
|
||||
$_id = ltrim(rtrim(str_replace(PATH['project'] . '/entries/', '', $current_entry->getPath()), '/'), '/');
|
||||
$this->entries[$_id] = $this->fetchSingle($_id);
|
||||
}
|
||||
@@ -281,7 +281,7 @@ class Entries
|
||||
// Try to create directory for new entry
|
||||
if (Filesystem::createDir($entry_dir)) {
|
||||
// Check if new entry file exists
|
||||
if (! Filesystem::has($entry_file = $entry_dir . '/entry' . '.' . $this->container->registry->get('flextype.settings.entries.extension'))) {
|
||||
if (! Filesystem::has($entry_file = $entry_dir . '/entry' . '.' . $this->flextype->registry->get('flextype.settings.entries.extension'))) {
|
||||
// Store data in the entry_create_data
|
||||
$this->entry_create_data = $data;
|
||||
|
||||
@@ -360,7 +360,7 @@ class Entries
|
||||
*/
|
||||
public function getFileLocation(string $id) : string
|
||||
{
|
||||
return PATH['project'] . '/entries/' . $id . '/entry' . '.' . $this->container->registry->get('flextype.settings.entries.extension');
|
||||
return PATH['project'] . '/entries/' . $id . '/entry' . '.' . $this->flextype->registry->get('flextype.settings.entries.extension');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -18,11 +18,6 @@ class Markdown
|
||||
*/
|
||||
protected $flextype;
|
||||
|
||||
/**
|
||||
* Application
|
||||
*/
|
||||
protected $flextype;
|
||||
|
||||
/**
|
||||
* Markdown
|
||||
*/
|
||||
@@ -35,9 +30,8 @@ class Markdown
|
||||
*/
|
||||
public function __construct($flextype, $markdown)
|
||||
{
|
||||
$this->flextype = $flextype;
|
||||
$this->container = $flextype->getContainer();
|
||||
$this->markdown = $markdown;
|
||||
$this->flextype = $flextype;
|
||||
$this->markdown = $markdown;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user