~tcuthbert/wordpress/openstack-objectstorage

« back to all changes in this revision

Viewing changes to src/OpenStack/ObjectStore/v1/Resource/Subdir.php

  • Committer: Jacek Nykis
  • Date: 2015-02-11 15:35:31 UTC
  • Revision ID: jacek.nykis@canonical.com-20150211153531-hmy6zi0ov2qfkl0b
Initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
/*
 
4
 * (c) Copyright 2012-2014 Hewlett-Packard Development Company, L.P.
 
5
 *
 
6
 * Licensed under the Apache License, Version 2.0 (the "License"); you may
 
7
 * not use this file except in compliance with the License. You may obtain
 
8
 * a copy of the License at
 
9
 *
 
10
 *      http://www.apache.org/licenses/LICENSE-2.0
 
11
 *
 
12
 * Unless required by applicable law or agreed to in writing, software
 
13
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 
14
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 
15
 * License for the specific language governing permissions and limitations
 
16
 * under the License.
 
17
 */
 
18
 
 
19
namespace OpenStack\ObjectStore\v1\Resource;
 
20
 
 
21
/**
 
22
 * Represent a subdirectory (subdir) entry.
 
23
 *
 
24
 * Depending on the method with which Swift container requests are
 
25
 * executed, Swift may return subdir entries instead of Objects.
 
26
 *
 
27
 * Subdirs are used for things that are directory-like.
 
28
 */
 
29
class Subdir
 
30
{
 
31
    /**
 
32
     * @var string The path string that this subdir describes
 
33
     */
 
34
    protected $path;
 
35
 
 
36
    /**
 
37
     * @var string The delimiter used in this path
 
38
     */
 
39
    protected $delimiter;
 
40
 
 
41
    /**
 
42
     * Create a new subdirectory.
 
43
     *
 
44
     * This represents a remote response's tag for a subdirectory.
 
45
     *
 
46
     * @param string $path      The path string that this subdir describes.
 
47
     * @param string $delimiter The delimiter used in this path.
 
48
     */
 
49
    public function __construct($path, $delimiter = '/')
 
50
    {
 
51
        $this->path = $path;
 
52
        $this->delimiter = $delimiter;
 
53
    }
 
54
 
 
55
    /**
 
56
     * Get the path.
 
57
     *
 
58
     * The path is delimited using the string returned by delimiter().
 
59
     *
 
60
     * @return string The path
 
61
     */
 
62
    public function path()
 
63
    {
 
64
        return $this->path;
 
65
    }
 
66
    /**
 
67
     * Get the delimiter used by the server.
 
68
     *
 
69
     * @return string The value used as a delimiter.
 
70
     */
 
71
    public function delimiter()
 
72
    {
 
73
        return $this->delimiter;
 
74
    }
 
75
}