1 | <?php |
||
14 | final class PersistentCollectionException extends MongoDBException |
||
15 | { |
||
16 | public static function directoryNotWritable() : self |
||
17 | { |
||
18 | return new self('Your PersistentCollection directory must be writable.'); |
||
19 | } |
||
20 | |||
21 | public static function directoryRequired() : self |
||
25 | |||
26 | public static function namespaceRequired() : self |
||
27 | { |
||
28 | return new self('You must configure a PersistentCollection namespace. See docs for details'); |
||
29 | } |
||
30 | |||
31 | public static function invalidParameterTypeHint( |
||
32 | string $className, |
||
33 | string $methodName, |
||
34 | string $parameterName, |
||
35 | ?Throwable $previous = null |
||
36 | ) : self { |
||
37 | return new self( |
||
38 | sprintf( |
||
39 | 'The type hint of parameter "%s" in method "%s" in class "%s" is invalid.', |
||
40 | $parameterName, |
||
41 | $methodName, |
||
42 | $className |
||
43 | ), |
||
44 | 0, |
||
45 | $previous |
||
46 | ); |
||
47 | } |
||
48 | |||
49 | public static function invalidReturnTypeHint(string $className, string $methodName, ?Throwable $previous = null) : self |
||
50 | { |
||
51 | return new self( |
||
52 | sprintf( |
||
53 | 'The return type of method "%s" in class "%s" is invalid.', |
||
54 | $methodName, |
||
55 | $className |
||
56 | ), |
||
57 | 0, |
||
58 | $previous |
||
59 | ); |
||
60 | } |
||
61 | |||
62 | public static function parentClassRequired(string $className, string $methodName) : self |
||
72 | |||
73 | public static function ownerRequiredToLoadCollection() : self |
||
74 | { |
||
75 | return new self('Cannot load persistent collection without an owner.'); |
||
76 | } |
||
77 | } |
||
78 |