Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 14 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| SiteClassification | |
0.00% |
0 / 14 |
|
0.00% |
0 / 2 |
72 | |
0.00% |
0 / 1 |
| get_primary_type | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
20 | |||
| get_secondary_type | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
20 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace NewfoldLabs\WP\Module\Patterns; |
| 4 | |
| 5 | use NewfoldLabs\WP\Module\Data\SiteClassification\PrimaryType; |
| 6 | use NewfoldLabs\WP\Module\Data\SiteClassification\SecondaryType; |
| 7 | |
| 8 | /** |
| 9 | * Site classification. |
| 10 | */ |
| 11 | class SiteClassification { |
| 12 | |
| 13 | /** |
| 14 | * Retrieve primary type. |
| 15 | * |
| 16 | * @var string |
| 17 | */ |
| 18 | public static function get_primary_type() { |
| 19 | |
| 20 | if ( ! class_exists( 'NewfoldLabs\WP\Module\Data\SiteClassification\PrimaryType' ) ) { |
| 21 | return ''; |
| 22 | } |
| 23 | |
| 24 | $primary_type = PrimaryType::instantiate_from_option(); |
| 25 | |
| 26 | if ( ! $primary_type ) { |
| 27 | return ''; |
| 28 | } |
| 29 | |
| 30 | $primary_type = $primary_type->to_array(); |
| 31 | |
| 32 | return isset( $primary_type['value'] ) ? $primary_type['value'] : ''; |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Retrieve secondary type. |
| 37 | * |
| 38 | * @var string |
| 39 | */ |
| 40 | public static function get_secondary_type() { |
| 41 | |
| 42 | if ( ! class_exists( 'NewfoldLabs\WP\Module\Data\SiteClassification\SecondaryType' ) ) { |
| 43 | return ''; |
| 44 | } |
| 45 | |
| 46 | $secondary_type = SecondaryType::instantiate_from_option(); |
| 47 | |
| 48 | if ( ! $secondary_type ) { |
| 49 | return ''; |
| 50 | } |
| 51 | |
| 52 | $secondary_type = $secondary_type->to_array(); |
| 53 | |
| 54 | return isset( $secondary_type['value'] ) ? $secondary_type['value'] : ''; |
| 55 | } |
| 56 | } |