• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / 329e7257b699570577e9617a4ea672714686da15

26 Jan 2026 07:52AM UTC coverage: 52.923% (-0.4%) from 53.35%
329e7257b699570577e9617a4ea672714686da15

Pull #22888

github

web-flow
Merge 00d428c6c into ff2f33de1
Pull Request #22888: Add integration tests for analytics adapter

8393 of 15825 branches covered (53.04%)

Branch coverage included in aggregate %.

32383 of 61223 relevant lines covered (52.89%)

47097.05 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.67
/src/editors/framework/integrations/multilingual.php
1
<?php
2

3
// @phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- This namespace should reflect the namespace of the original class.
4
namespace Yoast\WP\SEO\Editors\Framework\Integrations;
5

6
use Yoast\WP\SEO\Conditionals\Third_Party\Polylang_Conditional;
7
use Yoast\WP\SEO\Conditionals\Third_Party\TranslatePress_Conditional;
8
use Yoast\WP\SEO\Conditionals\Third_Party\WPML_Conditional;
9
use Yoast\WP\SEO\Editors\Domain\Integrations\Integration_Data_Provider_Interface;
10

11
/**
12
 * Describes if the Multilingual integration is enabled.
13
 */
14
class Multilingual implements Integration_Data_Provider_Interface {
15

16
        /**
17
         * The WPML conditional.
18
         *
19
         * @var WPML_Conditional
20
         */
21
        private $wpml_conditional;
22

23
        /**
24
         * The Polylang conditional.
25
         *
26
         * @var Polylang_Conditional
27
         */
28
        private $polylang_conditional;
29

30
        /**
31
         * The TranslatePress conditional.
32
         *
33
         * @var TranslatePress_Conditional
34
         */
35
        private $translate_press_conditional;
36

37
        /**
38
         * The constructor.
39
         *
40
         * @param WPML_Conditional           $wpml_conditional            The wpml conditional.
41
         * @param Polylang_Conditional       $polylang_conditional        The polylang conditional.
42
         * @param TranslatePress_Conditional $translate_press_conditional The translate press conditional.
43
         */
44
        public function __construct( WPML_Conditional $wpml_conditional, Polylang_Conditional $polylang_conditional, TranslatePress_Conditional $translate_press_conditional ) {
8✔
45
                $this->wpml_conditional            = $wpml_conditional;
8✔
46
                $this->polylang_conditional        = $polylang_conditional;
8✔
47
                $this->translate_press_conditional = $translate_press_conditional;
8✔
48
        }
49

50
        /**
51
         * If the integration is activated.
52
         *
53
         * @return bool If the integration is activated.
54
         */
55
        public function is_enabled(): bool {
8✔
56
                return $this->multilingual_plugin_active();
8✔
57
        }
58

59
        /**
60
         * Return this object represented by a key value array.
61
         *
62
         * @return array<string, bool> Returns the name and if the feature is enabled.
63
         */
64
        public function to_array(): array {
×
65
                return [ 'isMultilingualActive' => $this->is_enabled() ];
×
66
        }
67

68
        /**
69
         * Returns this object represented by a key value structure that is compliant with the script data array.
70
         *
71
         * @return array<string, bool> Returns the legacy key and if the feature is enabled.
72
         */
73
        public function to_legacy_array(): array {
8✔
74
                return [ 'multilingualPluginActive' => $this->is_enabled() ];
8✔
75
        }
76

77
        /**
78
         * Checks whether a multilingual plugin is currently active. Currently, we only check the following plugins:
79
         * WPML, Polylang, and TranslatePress.
80
         *
81
         * @return bool Whether a multilingual plugin is currently active.
82
         */
83
        private function multilingual_plugin_active() {
8✔
84
                $wpml_active           = $this->wpml_conditional->is_met();
8✔
85
                $polylang_active       = $this->polylang_conditional->is_met();
8✔
86
                $translatepress_active = $this->translate_press_conditional->is_met();
8✔
87

88
                return ( $wpml_active || $polylang_active || $translatepress_active );
8✔
89
        }
90
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc