These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of the puli/repository package. |
||
5 | * |
||
6 | * (c) Bernhard Schussek <[email protected]> |
||
7 | * |
||
8 | * For the full copyright and license information, please view the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | namespace Puli\Repository\Api\ChangeStream; |
||
13 | |||
14 | use Puli\Repository\Api\NoVersionFoundException; |
||
15 | use Puli\Repository\Api\Resource\PuliResource; |
||
16 | use Puli\Repository\Api\ResourceRepository; |
||
17 | |||
18 | /** |
||
19 | * Tracks different versions of a resource. |
||
20 | * |
||
21 | * @since 1.0 |
||
22 | * |
||
23 | * @author Titouan Galopin <[email protected]> |
||
24 | * @author Bernhard Schussek <[email protected]> |
||
25 | */ |
||
26 | interface ChangeStream |
||
27 | { |
||
28 | /** |
||
29 | * Stores a new version of a resource. |
||
30 | * |
||
31 | * @param PuliResource $resource The resource to store. |
||
32 | */ |
||
33 | public function append(PuliResource $resource); |
||
34 | |||
35 | /** |
||
36 | * Removes all versions stored for a path. |
||
37 | * |
||
38 | * @param string $path The Puli path. |
||
39 | */ |
||
40 | public function purge($path); |
||
1 ignored issue
–
show
|
|||
41 | |||
42 | /** |
||
43 | * Returns whether the stream contains any version for a path. |
||
44 | * |
||
45 | * @param string $path The Puli path. |
||
46 | * |
||
47 | * @return bool Returns `true` if a version can be found and `false` otherwise. |
||
48 | */ |
||
49 | public function contains($path); |
||
50 | |||
51 | /** |
||
52 | * Removes all contents of the stream. |
||
53 | */ |
||
54 | public function clear(); |
||
1 ignored issue
–
show
For interfaces and abstract methods it is generally a good practice to add a
@return annotation even if it is just @return void or @return null , so that implementors know what to do in the overridden method.
For interface and abstract methods, it is impossible to infer the return type
from the immediate code. In these cases, it is generally advisible to explicitly
annotate these methods with a
Loading history...
|
|||
55 | |||
56 | /** |
||
57 | * Returns all versions of a resource. |
||
58 | * |
||
59 | * @param string $path The Puli path to look for. |
||
60 | * @param ResourceRepository $repository The repository to attach the |
||
0 ignored issues
–
show
Should the type for parameter
$repository not be null|ResourceRepository ?
This check looks for It makes a suggestion as to what type it considers more descriptive. Most often this is a case of a parameter that can be null in addition to its declared types.
Loading history...
|
|||
61 | * resources to. |
||
62 | * |
||
63 | * @return VersionList The versions of the resource. |
||
64 | * |
||
65 | * @throws NoVersionFoundException If no version is found for the path. |
||
66 | */ |
||
67 | public function getVersions($path, ResourceRepository $repository = null); |
||
68 | } |
||
69 |
For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a
@return
doc comment to communicate to implementors of these methods what they are expected to return.