| @@ 114-139 (lines=26) @@ | ||
| 111 | * @throws FoundationException |
|
| 112 | * @return ClientInterface |
|
| 113 | */ |
|
| 114 | private function createCustomClient($identifier) |
|
| 115 | { |
|
| 116 | try { |
|
| 117 | $refl = new \ReflectionClass($identifier); |
|
| 118 | ||
| 119 | if (!$refl->implementsInterface('\PommProject\Foundation\Client\ClientInterface')) { |
|
| 120 | throw new FoundationException( |
|
| 121 | sprintf( |
|
| 122 | "Class '%s' must implement '\PommProject\Foundation\Client\ClientInterface'.", |
|
| 123 | $identifier |
|
| 124 | ) |
|
| 125 | ); |
|
| 126 | } |
|
| 127 | } catch (\ReflectionException $e) { |
|
| 128 | throw new FoundationException( |
|
| 129 | sprintf( |
|
| 130 | "Cannot find inspector class '%s'.", |
|
| 131 | $identifier |
|
| 132 | ), |
|
| 133 | null, |
|
| 134 | $e |
|
| 135 | ); |
|
| 136 | } |
|
| 137 | ||
| 138 | return new $identifier; |
|
| 139 | } |
|
| 140 | } |
|
| 141 | ||
| @@ 75-100 (lines=26) @@ | ||
| 72 | * @throws FoundationException if not valid |
|
| 73 | * @return string $builder_class |
|
| 74 | */ |
|
| 75 | private function checkSessionBuilderClass($builder_class) |
|
| 76 | { |
|
| 77 | try { |
|
| 78 | $reflection = new \ReflectionClass($builder_class); |
|
| 79 | ||
| 80 | if (!$reflection->isSubclassOf('\PommProject\Foundation\Session\SessionBuilder')) { |
|
| 81 | throw new FoundationException( |
|
| 82 | sprintf( |
|
| 83 | "Class '%s' is not a subclass of \PommProject\Foundation\Session\SessionBuilder.", |
|
| 84 | $builder_class |
|
| 85 | ) |
|
| 86 | ); |
|
| 87 | } |
|
| 88 | } catch (\ReflectionException $e) { |
|
| 89 | throw new FoundationException( |
|
| 90 | sprintf( |
|
| 91 | "Could not instantiate class '%s'.", |
|
| 92 | $builder_class |
|
| 93 | ), |
|
| 94 | null, |
|
| 95 | $e |
|
| 96 | ); |
|
| 97 | } |
|
| 98 | ||
| 99 | return $builder_class; |
|
| 100 | } |
|
| 101 | ||
| 102 | /** |
|
| 103 | * setDefaultBuilder |
|