Skip to content

Commit

Permalink
Abstract classes refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel910 committed Jul 13, 2016
1 parent 297f077 commit e964ec7
Show file tree
Hide file tree
Showing 151 changed files with 335 additions and 339 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -24,7 +24,7 @@ CHANGELOG
* Security now provides a shorter access to firewall: instead of `$this->security()->firewall('admin');` we can now use `$this->security('admin')`
* `createPasswordHash($password)` method is now exposed in a Firewall: `$this->security('admin')->createPasswordHash($password);`
* `json_encode()` now triggers `__toString()` magic method on EntityAbstract
* ArrayObject now has a `mergeSmart()` method which works exactly as ConfigObject mergeWith() algorithm.
* ArrayObjectStdObject now has a `mergeSmart()` method which works exactly as ConfigObject mergeWith() algorithm.

1.0.0
---------
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Expand Up @@ -7,7 +7,7 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
stopOnFailure="true"
syntaxCheck="false"
stderr="true"
bootstrap="vendor/autoload.php"
Expand Down
2 changes: 1 addition & 1 deletion src/Webiny/Component/Amazon/Tests/Mocks/S3BridgeMock.php
Expand Up @@ -19,7 +19,7 @@ class S3BridgeMock extends \PHPUnit_Framework_TestCase implements S3ClientInterf
{
private $instance;

public function __construct($accessKeyId, $secretAccessKey, $region)
public function __construct($accessKeyId, $secretAccessKey, $region, $endpoint = null)
{
$this->instance = $this->getMockBuilder('\Aws\S3\S3Client')
->disableOriginalConstructor()
Expand Down
Expand Up @@ -7,14 +7,14 @@

namespace Webiny\Component\Annotations\Bridge;

use Webiny\Component\StdLib\Exception\ExceptionAbstract;
use Webiny\Component\StdLib\Exception\AbstractException;

/**
* Annotations exception class.
*
* @package Webiny\Component\Annotations\Bridge
*/
class AnnotationsException extends ExceptionAbstract
class AnnotationsException extends AbstractException
{

}
4 changes: 2 additions & 2 deletions src/Webiny/Component/Bootstrap/BootstrapException.php
Expand Up @@ -7,12 +7,12 @@

namespace Webiny\Component\Bootstrap;

use Webiny\Component\StdLib\Exception\ExceptionAbstract;
use Webiny\Component\StdLib\Exception\AbstractException;

/**
* Bootstrap exception class.
*
* @package Webiny\Component\Bootstrap
*/

class BootstrapException extends ExceptionAbstract {}
class BootstrapException extends AbstractException {}
2 changes: 1 addition & 1 deletion src/Webiny/Component/Cache/Bridge/APC.php
Expand Up @@ -14,7 +14,7 @@
*
* @package Webiny\Component\Cache\Bridge
*/
class APC extends CacheAbstract
class APC extends AbstractCache
{

/**
Expand Down
Expand Up @@ -14,7 +14,7 @@
*
* @package Webiny\Component\Cache\Bridge;
*/
abstract class CacheAbstract implements StorageInterface
abstract class AbstractCache implements StorageInterface
{
use ValidatorTrait;

Expand Down
4 changes: 2 additions & 2 deletions src/Webiny/Component/Cache/Bridge/CacheException.php
Expand Up @@ -7,14 +7,14 @@

namespace Webiny\Component\Cache\Bridge;

use Webiny\Component\StdLib\Exception\ExceptionAbstract;
use Webiny\Component\StdLib\Exception\AbstractException;

/**
* Cache bridge exception class.
*
* @package Webiny\Component\Cache\Bridge
*/
class CacheException extends ExceptionAbstract
class CacheException extends AbstractException
{

}
4 changes: 2 additions & 2 deletions src/Webiny/Component/Cache/Bridge/Couchbase.php
Expand Up @@ -15,7 +15,7 @@
*
* @package Webiny\Component\Cache\Bridge
*/
class Couchbase extends CacheAbstract
class Couchbase extends AbstractCache
{

/**
Expand Down Expand Up @@ -46,7 +46,7 @@ public static function setLibrary($pathToClass)
}

/**
* Override the CacheAbstract::getInstance method.
* Override the AbstractCache::getInstance method.
*
* @see CacheAbstract::getInstance()
*
Expand Down
4 changes: 2 additions & 2 deletions src/Webiny/Component/Cache/Bridge/Memcache.php
Expand Up @@ -14,7 +14,7 @@
*
* @package Webiny\Component\Cache\Bridge
*/
class Memcache extends CacheAbstract
class Memcache extends AbstractCache
{

/**
Expand Down Expand Up @@ -45,7 +45,7 @@ public static function setLibrary($pathToClass)
}

/**
* Override the CacheAbstract::getInstance method.
* Override the AbstractCache::getInstance method.
*
* @see CacheAbstract::getInstance()
*
Expand Down
4 changes: 2 additions & 2 deletions src/Webiny/Component/Cache/Bridge/Redis.php
Expand Up @@ -14,7 +14,7 @@
*
* @package Webiny\Component\Cache\Bridge
*/
class Redis extends CacheAbstract
class Redis extends AbstractCache
{

/**
Expand Down Expand Up @@ -45,7 +45,7 @@ public static function setLibrary($pathToClass)
}

/**
* Override the CacheAbstract::getInstance method.
* Override the AbstractCache::getInstance method.
*
* @see CacheAbstract::getInstance()
*
Expand Down
4 changes: 2 additions & 2 deletions src/Webiny/Component/Cache/CacheException.php
Expand Up @@ -8,13 +8,13 @@

namespace Webiny\Component\Cache;

use Webiny\Component\StdLib\Exception\ExceptionAbstract;
use Webiny\Component\StdLib\Exception\AbstractException;

/**
* Class CacheException.
* @package Webiny\Component\Cache
*/
class CacheException extends ExceptionAbstract
class CacheException extends AbstractException
{
const MSG_UNSUPPORTED_DRIVER = 101;

Expand Down
2 changes: 1 addition & 1 deletion src/Webiny/Component/ClassLoader/ClassLoader.php
Expand Up @@ -9,7 +9,7 @@

use Webiny\Component\Cache\CacheStorage;

require_once __DIR__ . '/Loaders/LoaderAbstract.php';
require_once __DIR__ . '/Loaders/AbstractLoader.php';
require_once __DIR__ . '/Loaders/Pear.php';
require_once __DIR__ . '/Loaders/Psr0.php';
require_once __DIR__ . '/Loaders/Psr4.php';
Expand Down
Expand Up @@ -13,7 +13,7 @@
* @package Webiny\Component\ClassLoader\Loaders
*/

abstract class LoaderAbstract
abstract class AbstractLoader
{
/**
* @var bool|array A list of registered maps.
Expand Down
4 changes: 2 additions & 2 deletions src/Webiny/Component/ClassLoader/Loaders/Pear.php
Expand Up @@ -12,10 +12,10 @@
*
* @package Webiny\Component\ClassLoader\Loaders
*/
class Pear extends LoaderAbstract
class Pear extends AbstractLoader
{
/**
* @var LoaderAbstract Holds the loader instance.
* @var AbstractLoader Holds the loader instance.
*/
protected static $instance = null;

Expand Down
4 changes: 2 additions & 2 deletions src/Webiny/Component/ClassLoader/Loaders/Psr0.php
Expand Up @@ -12,10 +12,10 @@
*
* @package Webiny\Component\ClassLoader\Loaders
*/
class Psr0 extends LoaderAbstract
class Psr0 extends AbstractLoader
{
/**
* @var LoaderAbstract Holds the loader instance.
* @var AbstractLoader Holds the loader instance.
*/
protected static $instance = null;

Expand Down
4 changes: 2 additions & 2 deletions src/Webiny/Component/ClassLoader/Loaders/Psr4.php
Expand Up @@ -12,10 +12,10 @@
*
* @package Webiny\Component\ClassLoader\Loaders
*/
class Psr4 extends LoaderAbstract
class Psr4 extends AbstractLoader
{
/**
* @var LoaderAbstract Holds the loader instance.
* @var AbstractLoader Holds the loader instance.
*/
protected static $instance = null;

Expand Down
4 changes: 2 additions & 2 deletions src/Webiny/Component/Config/Bridge/Yaml/Yaml.php
Expand Up @@ -7,7 +7,7 @@

namespace Webiny\Component\Config\Bridge\Yaml;

use Webiny\Component\StdLib\Exception\ExceptionAbstract;
use Webiny\Component\StdLib\Exception\AbstractException;
use Webiny\Component\StdLib\StdLibTrait;
use Webiny\Component\StdLib\StdObject\FileObject\FileObject;
use Webiny\Component\StdLib\StdObject\StdObjectWrapper;
Expand Down Expand Up @@ -65,7 +65,7 @@ public static function setDriver($driver)
return;
}
}
throw new YamlException(ExceptionAbstract::MSG_INVALID_ARG, [
throw new YamlException(AbstractException::MSG_INVALID_ARG, [
'$driver',
self::$driverInterface
]
Expand Down
4 changes: 2 additions & 2 deletions src/Webiny/Component/Config/Bridge/Yaml/YamlException.php
Expand Up @@ -9,14 +9,14 @@
*/
namespace Webiny\Component\Config\Bridge\Yaml;

use Webiny\Component\StdLib\Exception\ExceptionAbstract;
use Webiny\Component\StdLib\Exception\AbstractException;

/**
* Config exception class.
*
* @package Webiny\Component\Config\Bridge\Yaml
*/
class YamlException extends ExceptionAbstract
class YamlException extends AbstractException
{

}
8 changes: 4 additions & 4 deletions src/Webiny/Component/Config/Config.php
Expand Up @@ -7,7 +7,7 @@

namespace Webiny\Component\Config;

use Webiny\Component\Config\Drivers\DriverAbstract;
use Webiny\Component\Config\Drivers\AbstractDriver;
use Webiny\Component\Config\Drivers\IniDriver;
use Webiny\Component\Config\Drivers\JsonDriver;
use Webiny\Component\Config\Drivers\PhpDriver;
Expand Down Expand Up @@ -114,17 +114,17 @@ public function php($resource, $flushCache = false)

/**
* Parse resource and create a Config object
* A valid resource is a PHP array, ArrayObject or an instance of DriverAbstract
* A valid resource is a PHP array, ArrayObject or an instance of AbstractDriver
*
* @param array|ArrayObject|DriverAbstract $resource Config resource
* @param array|ArrayObject|AbstractDriver $resource Config resource
* @param bool $flushCache Flush existing cache and load config file
*
* @return ConfigObject
*/
public function parseResource($resource, $flushCache = false)
{
$driver = $resource;
$driverAbstractClassName = '\Webiny\Component\Config\Drivers\DriverAbstract';
$driverAbstractClassName = '\Webiny\Component\Config\Drivers\AbstractDriver';
if (self::isInstanceOf($resource, $driverAbstractClassName)) {
$resource = $resource->getResource();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Webiny/Component/Config/ConfigException.php
Expand Up @@ -9,14 +9,14 @@
*/
namespace Webiny\Component\Config;

use Webiny\Component\StdLib\Exception\ExceptionAbstract;
use Webiny\Component\StdLib\Exception\AbstractException;

/**
* Config exception class.
*
* @package Webiny\Component\Config
*/
class ConfigException extends ExceptionAbstract
class ConfigException extends AbstractException
{

}
8 changes: 4 additions & 4 deletions src/Webiny/Component/Config/ConfigObject.php
Expand Up @@ -9,7 +9,7 @@

use Serializable;
use Traversable;
use Webiny\Component\Config\Drivers\DriverAbstract;
use Webiny\Component\Config\Drivers\AbstractDriver;
use Webiny\Component\Config\Drivers\IniDriver;
use Webiny\Component\Config\Drivers\JsonDriver;
use Webiny\Component\Config\Drivers\PhpDriver;
Expand Down Expand Up @@ -96,7 +96,7 @@ public function getAsJson()
return $driver->getString();
}

public function getAs(DriverAbstract $driver)
public function getAs(AbstractDriver $driver)
{
return $driver->getString();
}
Expand Down Expand Up @@ -170,15 +170,15 @@ public function set($name, $value)
/**
* ConfigObject is an object representing config data in an OO way
*
* @param array|ArrayObject|DriverAbstract $resource Config resource
* @param array|ArrayObject|AbstractDriver $resource Config resource
*
* @param bool $cache Store ConfigObject to cache or not
*
* @throws ConfigException
*/
public function __construct($resource = [], $cache = true)
{
$driverAbstractClassName = '\Webiny\Component\Config\Drivers\DriverAbstract';
$driverAbstractClassName = '\Webiny\Component\Config\Drivers\AbstractDriver';
$arrayObjectClassName = '\Webiny\Component\StdLib\StdObject\ArrayObject\ArrayObject';

// Validate given resources
Expand Down
Expand Up @@ -22,7 +22,7 @@
*
* @package Webiny\Component\Config\Drivers;
*/
abstract class DriverAbstract
abstract class AbstractDriver
{
use StdLibTrait;

Expand Down Expand Up @@ -99,7 +99,7 @@ final public function getString()
{
$res = $this->getStringInternal();
if (!$this->isString($res) && !$this->isStringObject($res)) {
throw new ConfigException('DriverAbstract method _getString() must return string or StringObject.');
throw new ConfigException('AbstractDriver method _getString() must return string or StringObject.');
}

return StdObjectWrapper::toString($res);
Expand All @@ -115,7 +115,7 @@ final public function getArray()
{
$res = $this->getArrayInternal();
if (!$this->isArray($res) && !$this->isArrayObject($res)) {
$errorMessage = 'DriverAbstract method _getArray() must return array or ArrayObject.';
$errorMessage = 'AbstractDriver method _getArray() must return array or ArrayObject.';
$errorMessage .= ' Make sure you have provided a valid config file path with file extension.';
throw new ConfigException($errorMessage);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Webiny/Component/Config/Drivers/IniDriver.php
Expand Up @@ -16,7 +16,7 @@
*
* @package Webiny\Component\Config\Drivers;
*/
class IniDriver extends DriverAbstract
class IniDriver extends AbstractDriver
{
private $delimiter = '.';
private $useSections = true;
Expand Down
2 changes: 1 addition & 1 deletion src/Webiny/Component/Config/Drivers/JsonDriver.php
Expand Up @@ -15,7 +15,7 @@
*
* @package Webiny\Component\Config\Drivers;
*/
class JsonDriver extends DriverAbstract
class JsonDriver extends AbstractDriver
{
/**
* Get config data as string
Expand Down
2 changes: 1 addition & 1 deletion src/Webiny/Component/Config/Drivers/PhpDriver.php
Expand Up @@ -14,7 +14,7 @@
*
* @package Webiny\Component\Config\Drivers;
*/
class PhpDriver extends DriverAbstract
class PhpDriver extends AbstractDriver
{
/**
* Get config data as string
Expand Down

0 comments on commit e964ec7

Please sign in to comment.