Skip to content
This repository was archived by the owner on Jun 25, 2025. It is now read-only.

Commit e66c295

Browse files
committed
All repositories have bucket
1 parent 49709f4 commit e66c295

File tree

5 files changed

+238
-0
lines changed

5 files changed

+238
-0
lines changed

App/AppRepositoryBucket.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Apisearch PHP Client.
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*
9+
* Feel free to edit as you please, and have fun.
10+
*
11+
* @author Marc Morera <[email protected]>
12+
* @author PuntMig Technologies
13+
*/
14+
15+
declare(strict_types=1);
16+
17+
namespace Apisearch\App;
18+
19+
/**
20+
* Class AppRepositoryBucket.
21+
*/
22+
class AppRepositoryBucket
23+
{
24+
/**
25+
* @var AppRepository[]
26+
*
27+
* Repositories
28+
*/
29+
private $repositories = [];
30+
31+
/**
32+
* Add repository.
33+
*
34+
* @param string $appName
35+
* @param AppRepository $repository
36+
*/
37+
public function addRepository(
38+
string $appName,
39+
AppRepository $repository
40+
) {
41+
$this->repositories[$appName] = $repository;
42+
}
43+
44+
/**
45+
* Get repository by name and index.
46+
*
47+
* @param string $appName
48+
*
49+
* @return AppRepository|null
50+
*/
51+
public function findRepository(string $appName): ? AppRepository
52+
{
53+
return isset($this->repositories[$appName])
54+
? $this->repositories[$appName]
55+
: null;
56+
}
57+
}

App/MockAppRepository.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ public function deleteToken(TokenUUID $tokenUUID)
4646
$this->throwMockException();
4747
}
4848

49+
/**
50+
* Get tokens.
51+
*
52+
* @return Token[]
53+
*/
54+
public function getTokens(): array
55+
{
56+
$this->throwMockException();
57+
}
58+
4959
/**
5060
* Throw exception.
5161
*

Event/EventRepositoryBucket.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Apisearch PHP Client.
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*
9+
* Feel free to edit as you please, and have fun.
10+
*
11+
* @author Marc Morera <[email protected]>
12+
* @author PuntMig Technologies
13+
*/
14+
15+
declare(strict_types=1);
16+
17+
namespace Apisearch\Event;
18+
19+
/**
20+
* Class EventRepositoryBucket.
21+
*/
22+
class EventRepositoryBucket
23+
{
24+
/**
25+
* @var EventRepository[]
26+
*
27+
* Repositories
28+
*/
29+
private $repositories = [];
30+
31+
/**
32+
* Add repository.
33+
*
34+
* @param string $name
35+
* @param EventRepository $repository
36+
*/
37+
public function addRepository(
38+
string $name,
39+
EventRepository $repository
40+
) {
41+
$this->repositories[$name] = $repository;
42+
}
43+
44+
/**
45+
* Get repository by name and index.
46+
*
47+
* @param string $name
48+
*
49+
* @return EventRepository|null
50+
*/
51+
public function findRepository(string $name): ? EventRepository
52+
{
53+
return isset($this->repositories[$name])
54+
? $this->repositories[$name]
55+
: null;
56+
}
57+
}

Log/LogRepositoryBucket.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Apisearch PHP Client.
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*
9+
* Feel free to edit as you please, and have fun.
10+
*
11+
* @author Marc Morera <[email protected]>
12+
* @author PuntMig Technologies
13+
*/
14+
15+
declare(strict_types=1);
16+
17+
namespace Apisearch\Log;
18+
19+
/**
20+
* Class LogRepositoryBucket.
21+
*/
22+
class LogRepositoryBucket
23+
{
24+
/**
25+
* @var LogRepository[]
26+
*
27+
* Repositories
28+
*/
29+
private $repositories = [];
30+
31+
/**
32+
* Add repository.
33+
*
34+
* @param string $name
35+
* @param LogRepository $repository
36+
*/
37+
public function addRepository(
38+
string $name,
39+
LogRepository $repository
40+
) {
41+
$this->repositories[$name] = $repository;
42+
}
43+
44+
/**
45+
* Get repository by name and index.
46+
*
47+
* @param string $name
48+
*
49+
* @return LogRepository|null
50+
*/
51+
public function findRepository(string $name): ? LogRepository
52+
{
53+
return isset($this->repositories[$name])
54+
? $this->repositories[$name]
55+
: null;
56+
}
57+
}

User/UserRepositoryBucket.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Apisearch PHP Client.
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*
9+
* Feel free to edit as you please, and have fun.
10+
*
11+
* @author Marc Morera <[email protected]>
12+
* @author PuntMig Technologies
13+
*/
14+
15+
declare(strict_types=1);
16+
17+
namespace Apisearch\User;
18+
19+
/**
20+
* Class UserRepositoryBucket.
21+
*/
22+
class UserRepositoryBucket
23+
{
24+
/**
25+
* @var UserRepository[]
26+
*
27+
* Repositories
28+
*/
29+
private $repositories = [];
30+
31+
/**
32+
* Add repository.
33+
*
34+
* @param string $name
35+
* @param UserRepository $repository
36+
*/
37+
public function addRepository(
38+
string $name,
39+
UserRepository $repository
40+
) {
41+
$this->repositories[$name] = $repository;
42+
}
43+
44+
/**
45+
* Get repository by name and index.
46+
*
47+
* @param string $name
48+
*
49+
* @return UserRepository|null
50+
*/
51+
public function findRepository(string $name): ? UserRepository
52+
{
53+
return isset($this->repositories[$name])
54+
? $this->repositories[$name]
55+
: null;
56+
}
57+
}

0 commit comments

Comments
 (0)