Skip to content

Commit ceb0c0e

Browse files
committed
style(convo-models): rename models array to typesenseModels
1 parent 7ac9547 commit ceb0c0e

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

src/ConversationModels.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ConversationModels implements \ArrayAccess
2222
/**
2323
* @var array
2424
*/
25-
private array $models = [];
25+
private array $typesenseModels = [];
2626

2727
/**
2828
* ConversationModels constructor.
@@ -44,11 +44,11 @@ public function __get($id)
4444
if (isset($this->{$id})) {
4545
return $this->{$id};
4646
}
47-
if (!isset($this->models[$id])) {
48-
$this->models[$id] = new ConversationModel($id, $this->apiCall);
47+
if (!isset($this->typesenseModels[$id])) {
48+
$this->typesenseModels[$id] = new ConversationModel($id, $this->apiCall);
4949
}
5050

51-
return $this->models[$id];
51+
return $this->typesenseModels[$id];
5252
}
5353

5454
/**
@@ -76,34 +76,34 @@ public function retrieve(): array
7676
*/
7777
public function offsetExists($offset): bool
7878
{
79-
return isset($this->models[$offset]);
79+
return isset($this->typesenseModels[$offset]);
8080
}
8181

8282
/**
8383
* @inheritDoc
8484
*/
8585
public function offsetGet($offset): ConversationModel
8686
{
87-
if (!isset($this->models[$offset])) {
88-
$this->models[$offset] = new ConversationModel($offset, $this->apiCall);
87+
if (!isset($this->typesenseModels[$offset])) {
88+
$this->typesenseModels[$offset] = new ConversationModel($offset, $this->apiCall);
8989
}
9090

91-
return $this->models[$offset];
91+
return $this->typesenseModels[$offset];
9292
}
9393

9494
/**
9595
* @inheritDoc
9696
*/
9797
public function offsetSet($offset, $value): void
9898
{
99-
$this->models[$offset] = $value;
99+
$this->typesenseModels[$offset] = $value;
100100
}
101101

102102
/**
103103
* @inheritDoc
104104
*/
105105
public function offsetUnset($offset): void
106106
{
107-
unset($this->models[$offset]);
107+
unset($this->typesenseModels[$offset]);
108108
}
109109
}

src/Conversations.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Conversations implements \ArrayAccess
1414
/**
1515
* @var ConversationModels
1616
*/
17-
public ConversationModels $models;
17+
public ConversationModels $typesenseModels;
1818

1919
/**
2020
* @var ApiCall
@@ -34,7 +34,7 @@ class Conversations implements \ArrayAccess
3434
public function __construct(ApiCall $apiCall)
3535
{
3636
$this->apiCall = $apiCall;
37-
$this->models = new ConversationModels($this->apiCall);
37+
$this->typesenseModels = new ConversationModels($this->apiCall);
3838
}
3939

4040
/**
@@ -51,7 +51,7 @@ public function retrieve(): array
5151
*/
5252
public function getModels(): ConversationModels
5353
{
54-
return $this->models;
54+
return $this->typesenseModels;
5555
}
5656

5757
/**

tests/Feature/ConversationModelTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public function testCanGetAModelById(): void
1313
{
1414
$this->mockApiCall()->allows()->get($this->endPointPath(), [])->andReturns([]);
1515

16-
$response = $this->mockConversations()->models[$this->id]->retrieve();
16+
$response = $this->mockConversations()->typesenseModels[$this->id]->retrieve();
1717
$this->assertEquals([], $response);
1818
}
1919

@@ -24,15 +24,15 @@ public function testCanUpdateAModelById(): void
2424
];
2525
$this->mockApiCall()->allows()->put($this->endPointPath(), $data)->andReturns([]);
2626

27-
$response = $this->mockConversations()->models[$this->id]->update($data);
27+
$response = $this->mockConversations()->typesenseModels[$this->id]->update($data);
2828
$this->assertEquals([], $response);
2929
}
3030

3131
public function testCanDeleteAModelById(): void
3232
{
3333
$this->mockApiCall()->allows()->delete($this->endPointPath())->andReturns([]);
3434

35-
$response = $this->mockConversations()->models[$this->id]->delete();
35+
$response = $this->mockConversations()->typesenseModels[$this->id]->delete();
3636
$this->assertEquals([], $response);
3737
}
3838

tests/Feature/ConversationModelsTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ public function testCanCreateAModel(): void
1919

2020
$this->mockApiCall()->allows()->post(static::RESOURCE_PATH, $data)->andReturns([]);
2121

22-
$response = $this->mockConversations()->models->create($data);
22+
$response = $this->mockConversations()->typesenseModels->create($data);
2323
$this->assertEquals([], $response);
2424
}
2525

2626
public function testCanRetrieveAllModels(): void
2727
{
2828
$this->mockApiCall()->allows()->get(static::RESOURCE_PATH, [])->andReturns([]);
29-
$this->mockConversations()->models->retrieve();
29+
$this->mockConversations()->typesenseModels->retrieve();
3030

31-
$response = $this->client()->conversations->models->retrieve();
31+
$response = $this->client()->conversations->typesenseModels->retrieve();
3232
$this->assertEquals([], $response);
3333
}
3434
}

0 commit comments

Comments
 (0)