Skip to content

Commit ea4b8af

Browse files
committed
Renamed class Object to BaseObject
1 parent a6e9036 commit ea4b8af

File tree

9 files changed

+23
-23
lines changed

9 files changed

+23
-23
lines changed

samples/object_store/v1/objects/create.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
'content' => '{objectContent}',
1818
];
1919

20-
/** @var \OpenStack\ObjectStore\v1\Models\Object $object */
20+
/** @var \OpenStack\ObjectStore\v1\Models\BaseObject $object */
2121
$object = $openstack->objectStoreV1()
2222
->getContainer('{containerName}')
2323
->createObject($options);

samples/object_store/v1/objects/create_from_stream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
'stream' => $stream,
2323
];
2424

25-
/** @var \OpenStack\ObjectStore\v1\Models\Object $object */
25+
/** @var \OpenStack\ObjectStore\v1\Models\BaseObject $object */
2626
$object = $openstack->objectStoreV1()
2727
->getContainer('{containerName}')
2828
->createObject($options);

samples/object_store/v1/objects/create_large_object.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
$options['segmentContainer'] = 'test_segments';
2828

2929

30-
/** @var \OpenStack\ObjectStore\v1\Models\Object $object */
30+
/** @var \OpenStack\ObjectStore\v1\Models\BaseObject $object */
3131
$object = $openstack->objectStoreV1()
3232
->getContainer('test')
3333
->createLargeObject($options);

samples/object_store/v1/objects/get.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
'scope' => ['project' => ['id' => '{projectId}']]
1313
]);
1414

15-
/** @var \OpenStack\ObjectStore\v1\Models\Object $object */
15+
/** @var \OpenStack\ObjectStore\v1\Models\BaseObject $object */
1616
$object = $openstack->objectStoreV1()
1717
->getContainer('{containerName}')
1818
->getObject('{objectName}');

samples/object_store/v1/objects/list.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
->getContainer('{containerName}');
1717

1818
foreach ($container->listObjects() as $object) {
19-
/** @var \OpenStack\ObjectStore\v1\Models\Object $object */
19+
/** @var \OpenStack\ObjectStore\v1\Models\BaseObject $object */
2020
}

src/ObjectStore/v1/Models/Object.php renamed to src/ObjectStore/v1/Models/BaseObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
/**
1515
* @property \OpenStack\ObjectStore\v1\Api $api
1616
*/
17-
class Object extends OperatorResource implements Creatable, Deletable, HasMetadata
17+
class BaseObject extends OperatorResource implements Creatable, Deletable, HasMetadata
1818
{
1919
use MetadataTrait;
2020

src/ObjectStore/v1/Models/Container.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function populateFromResponse(ResponseInterface $response): self
6161
public function listObjects(array $options = [], callable $mapFn = null): \Generator
6262
{
6363
$options = array_merge($options, ['name' => $this->name, 'format' => 'json']);
64-
return $this->model(Object::class)->enumerate($this->api->getContainer(), $options, $mapFn);
64+
return $this->model(BaseObject::class)->enumerate($this->api->getContainer(), $options, $mapFn);
6565
}
6666

6767
/**
@@ -136,17 +136,17 @@ public function getMetadata(): array
136136
}
137137

138138
/**
139-
* Retrieves an Object and populates its `name` and `containerName` properties according to the name provided and
139+
* Retrieves an BaseObject and populates its `name` and `containerName` properties according to the name provided and
140140
* the name of this container. A HTTP call will not be executed by default - you need to call
141-
* {@see Object::retrieve} or {@see Object::download} on the returned Object object to do that.
141+
* {@see BaseObject::retrieve} or {@see BaseObject::download} on the returned BaseObject object to do that.
142142
*
143143
* @param string $name The name of the object
144144
*
145-
* @return Object
145+
* @return BaseObject
146146
*/
147-
public function getObject($name): Object
147+
public function getObject($name): BaseObject
148148
{
149-
return $this->model(Object::class, ['containerName' => $this->name, 'name' => $name]);
149+
return $this->model(BaseObject::class, ['containerName' => $this->name, 'name' => $name]);
150150
}
151151

152152
/**
@@ -179,13 +179,13 @@ public function objectExists(string $name): bool
179179
*
180180
* @return Object
181181
*/
182-
public function createObject(array $data): Object
182+
public function createObject(array $data): BaseObject
183183
{
184-
return $this->model(Object::class)->create($data + ['containerName' => $this->name]);
184+
return $this->model(BaseObject::class)->create($data + ['containerName' => $this->name]);
185185
}
186186

187187
/**
188-
* Creates a Dynamic Large Object by chunking a file into smaller segments and uploading them into a holding
188+
* Creates a Dynamic Large BaseObject by chunking a file into smaller segments and uploading them into a holding
189189
* container. When this completes, a manifest file is uploaded which references the prefix of the segments,
190190
* allowing concatenation when a request is executed against the manifest.
191191
*
@@ -195,9 +195,9 @@ public function createObject(array $data): Object
195195
* @param string $data['segmentPrefix'] The prefix that will come before each segment. If omitted, a default
196196
* is used: name/timestamp/filesize
197197
*
198-
* @return Object
198+
* @return BaseObject
199199
*/
200-
public function createLargeObject(array $data): Object
200+
public function createLargeObject(array $data): BaseObject
201201
{
202202
/** @var \Psr\Http\Message\StreamInterface $stream */
203203
$stream = $data['stream'];
@@ -218,7 +218,7 @@ public function createLargeObject(array $data): Object
218218
$count = 0;
219219

220220
while (!$stream->eof() && $count < round($stream->getSize() / $segmentSize)) {
221-
$promises[] = $this->model(Object::class)->createAsync([
221+
$promises[] = $this->model(BaseObject::class)->createAsync([
222222
'name' => sprintf("%s/%d", $segmentPrefix, ++$count),
223223
'stream' => new LimitStream($stream, $segmentSize, ($count - 1) * $segmentSize),
224224
'containerName' => $segmentContainer,

tests/unit/ObjectStore/v1/Models/ContainerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use OpenStack\Common\Error\BadResponseError;
99
use OpenStack\ObjectStore\v1\Api;
1010
use OpenStack\ObjectStore\v1\Models\Container;
11-
use OpenStack\ObjectStore\v1\Models\Object;
11+
use OpenStack\ObjectStore\v1\Models\BaseObject;
1212
use OpenStack\Test\TestCase;
1313
use Prophecy\Argument;
1414

@@ -95,7 +95,7 @@ public function test_It_Gets_Object()
9595
{
9696
$object = $this->container->getObject('foo.txt');
9797

98-
$this->assertInstanceOf(Object::class, $object);
98+
$this->assertInstanceOf(BaseObject::class, $object);
9999
$this->assertEquals('foo.txt', $object->name);
100100
}
101101

@@ -135,7 +135,7 @@ public function test_it_lists_objects()
135135
->willReturn($this->getFixture('GET_Container'));
136136

137137
foreach ($this->container->listObjects(['limit' => 2]) as $object) {
138-
$this->assertInstanceOf(Object::class, $object);
138+
$this->assertInstanceOf(BaseObject::class, $object);
139139
}
140140
}
141141

tests/unit/ObjectStore/v1/Models/ObjectTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use function GuzzleHttp\Psr7\uri_for;
66
use GuzzleHttp\Psr7\Stream;
77
use OpenStack\ObjectStore\v1\Api;
8-
use OpenStack\ObjectStore\v1\Models\Object;
8+
use OpenStack\ObjectStore\v1\Models\BaseObject;
99
use OpenStack\Test\TestCase;
1010

1111
class ObjectTest extends TestCase
@@ -21,7 +21,7 @@ public function setUp()
2121

2222
$this->rootFixturesDir = dirname(__DIR__);
2323

24-
$this->object = new Object($this->client->reveal(), new Api());
24+
$this->object = new BaseObject($this->client->reveal(), new Api());
2525
$this->object->containerName = self::CONTAINER;
2626
$this->object->name = self::NAME;
2727
}

0 commit comments

Comments
 (0)