1 | <?php |
||
19 | class CdnFacade implements CdnFacadeInterface |
||
20 | { |
||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | protected $configurations; |
||
25 | |||
26 | /** |
||
27 | * @var \Publiux\laravelcdn\Contracts\ProviderFactoryInterface |
||
28 | */ |
||
29 | protected $provider_factory; |
||
30 | |||
31 | /** |
||
32 | * instance of the default provider object. |
||
33 | * |
||
34 | * @var \Publiux\laravelcdn\Providers\Contracts\ProviderInterface |
||
35 | */ |
||
36 | protected $provider; |
||
37 | |||
38 | /** |
||
39 | * @var \Publiux\laravelcdn\Contracts\CdnHelperInterface |
||
40 | */ |
||
41 | protected $helper; |
||
42 | |||
43 | /** |
||
44 | * @var \Publiux\laravelcdn\Validators\CdnFacadeValidator |
||
45 | */ |
||
46 | protected $cdn_facade_validator; |
||
47 | |||
48 | /** |
||
49 | * Calls the provider initializer. |
||
50 | * |
||
51 | * @param \Publiux\laravelcdn\Contracts\ProviderFactoryInterface $provider_factory |
||
52 | * @param \Publiux\laravelcdn\Contracts\CdnHelperInterface $helper |
||
53 | * @param \Publiux\laravelcdn\Validators\CdnFacadeValidator $cdn_facade_validator |
||
54 | */ |
||
55 | public function __construct( |
||
66 | |||
67 | /** |
||
68 | * Read the configuration file and pass it to the provider factory |
||
69 | * to return an object of the default provider specified in the |
||
70 | * config file. |
||
71 | */ |
||
72 | private function init() |
||
80 | |||
81 | /** |
||
82 | * this function will be called from the 'views' using the |
||
83 | * 'Cdn' facade {{Cdn::asset('')}} to convert the path into |
||
84 | * it's CDN url. |
||
85 | * |
||
86 | * @param $path |
||
87 | * |
||
88 | * @throws Exceptions\EmptyPathException |
||
89 | * |
||
90 | * @return mixed |
||
91 | */ |
||
92 | public function asset($path) |
||
97 | |||
98 | /** |
||
99 | * check if package is surpassed or not then |
||
100 | * prepare the path before generating the url. |
||
101 | * |
||
102 | * @param $path |
||
103 | * @param string $prepend |
||
104 | * |
||
105 | * @return mixed |
||
106 | */ |
||
107 | private function generateUrl($path, $prepend = '') |
||
133 | |||
134 | /** |
||
135 | * this function will be called from the 'views' using the |
||
136 | * 'Cdn' facade {{Cdn::mix('')}} to convert the Laravel 5.4 webpack mix |
||
137 | * generated file path into it's CDN url. |
||
138 | * |
||
139 | * @param $path |
||
140 | * |
||
141 | * @return mixed |
||
142 | * |
||
143 | * @throws Exceptions\EmptyPathException, \InvalidArgumentException |
||
144 | */ |
||
145 | public function mix($path) |
||
159 | |||
160 | /** |
||
161 | * this function will be called from the 'views' using the |
||
162 | * 'Cdn' facade {{Cdn::elixir('')}} to convert the elixir generated file path into |
||
163 | * it's CDN url. |
||
164 | * |
||
165 | * @param $path |
||
166 | * |
||
167 | * @throws Exceptions\EmptyPathException, \InvalidArgumentException |
||
168 | * |
||
169 | * @return mixed |
||
170 | */ |
||
171 | public function elixir($path) |
||
182 | |||
183 | /** |
||
184 | * this function will be called from the 'views' using the |
||
185 | * 'Cdn' facade {{Cdn::path('')}} to convert the path into |
||
186 | * it's CDN url. |
||
187 | * |
||
188 | * @param $path |
||
189 | * |
||
190 | * @throws Exceptions\EmptyPathException |
||
191 | * |
||
192 | * @return mixed |
||
193 | */ |
||
194 | public function path($path) |
||
198 | } |
||
199 |