IsActive.php
4 years ago
IsInstalled.php
4 years ago
IsNotActive.php
4 years ago
IsPluginActive.php
4 years ago
IsPluginNotActive.php
4 years ago
IsNotActive.php
34 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AC\Integration\Filter; |
| 4 | |
| 5 | use AC\Integration; |
| 6 | use AC\Integration\Filter; |
| 7 | use AC\Integrations; |
| 8 | |
| 9 | class IsNotActive implements Filter { |
| 10 | |
| 11 | /** |
| 12 | * @var bool |
| 13 | */ |
| 14 | private $is_multisite; |
| 15 | |
| 16 | /** |
| 17 | * @var bool |
| 18 | */ |
| 19 | private $is_network_admin; |
| 20 | |
| 21 | public function __construct( $is_multisite, $is_network_admin ) { |
| 22 | $this->is_multisite = (bool) $is_multisite; |
| 23 | $this->is_network_admin = (bool) $is_network_admin; |
| 24 | } |
| 25 | |
| 26 | public function filter( Integrations $integrations ) { |
| 27 | return new Integrations( array_filter( $integrations->all(), [ $this, 'is_not_active' ] ) ); |
| 28 | } |
| 29 | |
| 30 | private function is_not_active( Integration $integration ) { |
| 31 | return ! ( new IsActive( $this->is_multisite, $this->is_network_admin ) )->is_active( $integration ); |
| 32 | } |
| 33 | |
| 34 | } |