PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / 2.2
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF v2.2
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
imagify / classes / Dependencies / League / Container / ContainerAwareTrait.php

ContainerAwareTrait.php in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF 2.2, at classes/Dependencies/League/Container/ContainerAwareTrait.php

77 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php declare(strict_types=1);
2
3 namespace Imagify\Dependencies\League\Container;
4
5 use Imagify\Dependencies\League\Container\Exception\ContainerException;
6 use Imagify\Dependencies\Psr\Container\ContainerInterface;
7
8 trait ContainerAwareTrait
9 {
10 /**
11 * @var ContainerInterface
12 */
13 protected $container;
14
15 /**
16 * @var Container
17 */
18 protected $leagueContainer;
19
20 /**
21 * Set a container.
22 *
23 * @param ContainerInterface $container
24 *
25 * @return ContainerAwareInterface
26 */
27 public function setContainer(ContainerInterface $container) : ContainerAwareInterface
28 {
29 $this->container = $container;
30
31 return $this;
32 }
33
34 /**
35 * Get the container.
36 *
37 * @return ContainerInterface
38 */
39 public function getContainer() : ContainerInterface
40 {
41 if ($this->container instanceof ContainerInterface) {
42 return $this->container;
43 }
44
45 throw new ContainerException('No container implementation has been set.');
46 }
47
48 /**
49 * Set a container.
50 *
51 * @param Container $container
52 *
53 * @return self
54 */
55 public function setLeagueContainer(Container $container) : ContainerAwareInterface
56 {
57 $this->container = $container;
58 $this->leagueContainer = $container;
59
60 return $this;
61 }
62
63 /**
64 * Get the container.
65 *
66 * @return Container
67 */
68 public function getLeagueContainer() : Container
69 {
70 if ($this->leagueContainer instanceof Container) {
71 return $this->leagueContainer;
72 }
73
74 throw new ContainerException('No container implementation has been set.');
75 }
76 }
77