1: <?php
2: /**
3: * PHP OpenCloud library.
4: *
5: * @copyright 2013 Rackspace Hosting, Inc. See LICENSE for information.
6: * @license https://www.apache.org/licenses/LICENSE-2.0
7: * @author Glen Campbell <glen.campbell@rackspace.com>
8: * @author Jamie Hannaford <jamie.hannaford@rackspace.com>
9: */
10:
11: namespace OpenCloud\ObjectStore;
12:
13:
14: use OpenCloud\Common\Service\AbstractService as CommonAbstractService;
15: use OpenCloud\Common\Http\Message\Formatter;
16:
17: /**
18: * An abstract base class for common code shared between ObjectStore\Service
19: * (container) and ObjectStore\CDNService (CDN containers).
20: */
21: abstract class AbstractService extends CommonAbstractService
22: {
23: const MAX_CONTAINER_NAME_LENGTH = 256;
24: const MAX_OBJECT_NAME_LEN = 1024;
25: const MAX_OBJECT_SIZE = 5102410241025;
26:
27: /**
28: * List all available containers. If called by a CDN service, it returns CDN-enabled; if called by a regular
29: * service, normal containers are returned.
30: *
31: * @param array $filter
32: * @return Collection
33: */
34: public function listContainers(array $filter = array())
35: {
36: $filter['format'] = 'json';
37:
38: $class = ($this instanceof Service) ? 'Container' : 'CDNContainer';
39:
40: return $this->resourceList($class, $this->getUrl(null, $filter), $this);
41: }
42:
43: /**
44: * @return Resource\Account
45: */
46: public function getAccount()
47: {
48: return new Resource\Account($this);
49: }
50:
51: }
52: