mirror of
https://github.com/getgrav/grav.git
synced 2026-03-04 11:31:43 +01:00
Move new Collection/Object classes into Grav\Framework
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
namespace Grav\Common\Object;
|
||||
|
||||
use Grav\Common\Collection\Collection;
|
||||
use Grav\Common\Collection\ObjectCollectionInterface;
|
||||
use Grav\Common\Collection\ObjectCollectionTrait;
|
||||
|
||||
abstract class AbstractObjectCollection extends Collection implements ObjectCollectionInterface
|
||||
{
|
||||
use ObjectCollectionTrait, ObjectStorageTrait;
|
||||
|
||||
protected $id;
|
||||
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,20 @@
|
||||
<?php
|
||||
namespace Grav\Common\Collection;
|
||||
/**
|
||||
* @package Grav\Framework\Collection
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Grav\Framework\Collection;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
/**
|
||||
* General JSON serializable collection.
|
||||
*
|
||||
* @package Grav\Framework\Collection
|
||||
*/
|
||||
class Collection extends ArrayCollection implements CollectionInterface
|
||||
{
|
||||
/**
|
||||
@@ -1,8 +1,20 @@
|
||||
<?php
|
||||
namespace Grav\Common\Collection;
|
||||
/**
|
||||
* @package Grav\Framework\Collection
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Grav\Framework\Collection;
|
||||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
||||
/**
|
||||
* Collection Interface.
|
||||
*
|
||||
* @package Grav\Framework\Collection
|
||||
*/
|
||||
interface CollectionInterface extends Collection, \JsonSerializable
|
||||
{
|
||||
/**
|
||||
@@ -1,5 +1,12 @@
|
||||
<?php
|
||||
namespace Grav\Common\Object;
|
||||
/**
|
||||
* @package Grav\Framework\Object
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Grav\Framework\Object;
|
||||
|
||||
use RocketTheme\Toolbox\ArrayTraits\ArrayAccessWithGetters;
|
||||
use RocketTheme\Toolbox\ArrayTraits\Export;
|
||||
@@ -8,6 +15,7 @@ use RocketTheme\Toolbox\ArrayTraits\Export;
|
||||
* Abstract base class for stored objects.
|
||||
*
|
||||
* @property string $id
|
||||
* @package Grav\Framework\Object
|
||||
*/
|
||||
abstract class AbstractObject implements ObjectInterface
|
||||
{
|
||||
@@ -39,7 +47,7 @@ abstract class AbstractObject implements ObjectInterface
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
static protected $collectionClass = 'Grav\\Common\\Object\\AbstractObjectCollection';
|
||||
static protected $collectionClass = 'Grav\\Framework\\Object\\AbstractObjectCollection';
|
||||
|
||||
/**
|
||||
* Properties of the object.
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Grav\Framework\Object
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Grav\Framework\Object;
|
||||
|
||||
use Grav\Framework\Collection\Collection;
|
||||
|
||||
/**
|
||||
* Abstract Object Collection
|
||||
* @package Grav\Framework\Object
|
||||
*/
|
||||
abstract class AbstractObjectCollection extends Collection implements ObjectCollectionInterface
|
||||
{
|
||||
use ObjectCollectionTrait, ObjectStorageTrait;
|
||||
|
||||
protected $id;
|
||||
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,19 @@
|
||||
<?php
|
||||
namespace Grav\Common\Object;
|
||||
/**
|
||||
* @package Grav\Framework\Object
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
use Grav\Common\Object\Storage\StorageInterface;
|
||||
namespace Grav\Framework\Object;
|
||||
|
||||
use Grav\Framework\Object\Storage\StorageInterface;
|
||||
|
||||
/**
|
||||
* Abstract Object Finder
|
||||
* @package Grav\Framework\Object
|
||||
*/
|
||||
abstract class AbstractObjectFinder implements ObjectFinderInterface
|
||||
{
|
||||
/**
|
||||
@@ -1,6 +1,19 @@
|
||||
<?php
|
||||
namespace Grav\Common\Collection;
|
||||
/**
|
||||
* @package Grav\Framework\Object
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Grav\Framework\Object;
|
||||
|
||||
use Grav\Framework\Collection\CollectionInterface;
|
||||
|
||||
/**
|
||||
* ObjectCollection Interface
|
||||
* @package Grav\Framework\Collection
|
||||
*/
|
||||
interface ObjectCollectionInterface extends CollectionInterface
|
||||
{
|
||||
/**
|
||||
@@ -1,8 +1,25 @@
|
||||
<?php
|
||||
namespace Grav\Common\Collection;
|
||||
/**
|
||||
* @package Grav\Framework\Object
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Grav\Framework\Object;
|
||||
|
||||
/**
|
||||
* ObjectCollection Trait
|
||||
* @package Grav\Framework\Object
|
||||
*/
|
||||
trait ObjectCollectionTrait
|
||||
{
|
||||
/**
|
||||
* @param array $elements
|
||||
* @return static
|
||||
*/
|
||||
abstract public function createFrom(array $elements);
|
||||
|
||||
/**
|
||||
* Create a copy from this collection by cloning all objects in the collection.
|
||||
*
|
||||
@@ -1,6 +1,17 @@
|
||||
<?php
|
||||
namespace Grav\Common\Object;
|
||||
/**
|
||||
* @package Grav\Framework\Object
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Grav\Framework\Object;
|
||||
|
||||
/**
|
||||
* Object Finder Interface
|
||||
* @package Grav\Framework\Object
|
||||
*/
|
||||
interface ObjectFinderInterface
|
||||
{
|
||||
/**
|
||||
@@ -1,6 +1,17 @@
|
||||
<?php
|
||||
namespace Grav\Common\Object;
|
||||
/**
|
||||
* @package Grav\Framework\Object
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Grav\Framework\Object;
|
||||
|
||||
/**
|
||||
* Object Interface
|
||||
* @package Grav\Framework\Object
|
||||
*/
|
||||
interface ObjectInterface extends \ArrayAccess, \JsonSerializable
|
||||
{
|
||||
/**
|
||||
@@ -1,12 +1,20 @@
|
||||
<?php
|
||||
namespace Grav\Common\Object;
|
||||
/**
|
||||
* @package Grav\Framework\Object
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
use Grav\Common\Object\Storage\StorageInterface;
|
||||
namespace Grav\Framework\Object;
|
||||
|
||||
use Grav\Framework\Object\Storage\StorageInterface;
|
||||
|
||||
/**
|
||||
* Abstract base class for stored objects.
|
||||
* Trait for implementing stored objects.
|
||||
*
|
||||
* @property string $id
|
||||
* @package Grav\Framework\Object
|
||||
*/
|
||||
trait ObjectStorageTrait
|
||||
{
|
||||
@@ -358,9 +366,6 @@ trait ObjectStorageTrait
|
||||
return $this->getStorageKey();
|
||||
}
|
||||
|
||||
|
||||
//abstract public function setStorageKey(array $keys = []);
|
||||
|
||||
/**
|
||||
* @return StorageInterface
|
||||
*/
|
||||
@@ -1,10 +1,21 @@
|
||||
<?php
|
||||
namespace Grav\Common\Object\Storage;
|
||||
/**
|
||||
* @package Grav\Framework\Object\Storage
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Grav\Framework\Object\Storage;
|
||||
|
||||
use Grav\Common\Grav;
|
||||
use RocketTheme\Toolbox\File\FileInterface;
|
||||
use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator;
|
||||
|
||||
/**
|
||||
* FilesystemStorage
|
||||
* @package Grav\Framework\Object\Storage
|
||||
*/
|
||||
class FilesystemStorage implements StorageInterface
|
||||
{
|
||||
/**
|
||||
@@ -1,6 +1,17 @@
|
||||
<?php
|
||||
namespace Grav\Common\Object\Storage;
|
||||
/**
|
||||
* @package Grav\Framework\Object\Storage
|
||||
*
|
||||
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace Grav\Framework\Object\Storage;
|
||||
|
||||
/**
|
||||
* Interface StorageInterface
|
||||
* @package Grav\Framework\Object\Storage
|
||||
*/
|
||||
interface StorageInterface
|
||||
{
|
||||
/**
|
||||
Reference in New Issue
Block a user