1 | <?php |
||
50 | class AlgoliaComponent extends Component implements BootstrapInterface |
||
51 | { |
||
52 | /** |
||
53 | * @var string The application ID you have in your admin interface |
||
54 | */ |
||
55 | public $applicationId; |
||
56 | |||
57 | /** |
||
58 | * @var string A valid API key for the service |
||
59 | */ |
||
60 | public $apiKey; |
||
61 | |||
62 | /** |
||
63 | * @var null|array The list of hosts that you have received for the service |
||
64 | */ |
||
65 | public $hostsArray = null; |
||
66 | |||
67 | /** |
||
68 | * @var array |
||
69 | */ |
||
70 | public $options = []; |
||
71 | |||
72 | /** |
||
73 | * @var null|string |
||
74 | */ |
||
75 | public $env = null; |
||
76 | |||
77 | /** |
||
78 | * @var AlgoliaManager |
||
79 | */ |
||
80 | protected $manager; |
||
81 | |||
82 | /** |
||
83 | * @var AlgoliaFactory |
||
84 | */ |
||
85 | private $algoliaFactory; |
||
86 | |||
87 | /** |
||
88 | * @var ActiveRecordFactory |
||
89 | */ |
||
90 | private $activeRecordFactory; |
||
91 | |||
92 | /** |
||
93 | * Initiates a new AlgoliaComponent. |
||
94 | * |
||
95 | * @param AlgoliaFactory $algoliaFactory |
||
96 | * @param ActiveRecordFactory $activeRecordFactory |
||
97 | * @param array $config |
||
98 | */ |
||
99 | 24 | public function __construct(AlgoliaFactory $algoliaFactory, ActiveRecordFactory $activeRecordFactory, $config = []) |
|
106 | |||
107 | /** |
||
108 | * Bootstrap method to be called during application bootstrap stage. |
||
109 | * |
||
110 | * @param Application $app the application currently running |
||
111 | */ |
||
112 | public function bootstrap($app) |
||
118 | |||
119 | /** |
||
120 | * {@inheritdoc} |
||
121 | */ |
||
122 | 24 | public function init() |
|
126 | |||
127 | /** |
||
128 | * Returns a new AlgoliaManager. |
||
129 | * |
||
130 | * @return AlgoliaManager |
||
131 | */ |
||
132 | 24 | protected function createManager() |
|
142 | |||
143 | /** |
||
144 | * Dynamically pass methods to the AlgoliaManager. |
||
145 | * |
||
146 | * @param string $method |
||
147 | * @param array $parameters |
||
148 | * |
||
149 | * @return mixed |
||
150 | */ |
||
151 | 1 | public function __call($method, $parameters) |
|
155 | |||
156 | /** |
||
157 | * Generates config for the Algolia Manager. |
||
158 | * |
||
159 | * @return AlgoliaConfig |
||
160 | * @throws \Exception |
||
161 | */ |
||
162 | 24 | private function generateConfig() |
|
177 | } |
||
178 |