PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
← All changes | src/actions/importing/abstract-aioseo-importing-action.php +28 -9 18.3 → trunk View file →
@@ -2,8 +2,9 @@
2 2
3 3 namespace Yoast\WP\SEO\Actions\Importing;
4 4
5 5 use Exception;
6 +use Yoast\WP\SEO\Helpers\Aioseo_Helper;
6 7 use Yoast\WP\SEO\Helpers\Import_Cursor_Helper;
7 8 use Yoast\WP\SEO\Helpers\Options_Helper;
8 9 use Yoast\WP\SEO\Helpers\Sanitization_Helper;
9 10 use Yoast\WP\SEO\Services\Importing\Aioseo\Aioseo_Replacevar_Service;
@@ -11,10 +12,8 @@
11 12 use Yoast\WP\SEO\Services\Importing\Aioseo\Aioseo_Robots_Transformer_Service;
12 13
13 14 /**
14 15 * Importing action interface.
15 - *
16 - * @phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded
17 16 */
18 17 abstract class Abstract_Aioseo_Importing_Action implements Importing_Action_Interface {
19 18
20 19 /**
@@ -21,9 +20,9 @@
21 20 * The plugin the class deals with.
22 21 *
23 22 * @var string
24 23 */
25 - const PLUGIN = null;
24 + public const PLUGIN = null;
26 25
27 26 /**
28 27 * The type the class deals with.
29 28 *
@@ -28,11 +27,18 @@
28 27 * The type the class deals with.
29 28 *
30 29 * @var string
31 30 */
32 - const TYPE = null;
31 + public const TYPE = null;
33 32
34 33 /**
34 + * The AIOSEO helper.
35 + *
36 + * @var Aioseo_Helper
37 + */
38 + protected $aioseo_helper;
39 +
40 + /**
35 41 * The import cursor helper.
36 42 *
37 43 * @var Import_Cursor_Helper
38 44 */
@@ -99,8 +105,21 @@
99 105 $this->robots_transformer = $robots_transformer;
100 106 }
101 107
102 108 /**
109 + * Sets the AIOSEO helper.
110 + *
111 + * @required
112 + *
113 + * @param Aioseo_Helper $aioseo_helper The AIOSEO helper.
114 + *
115 + * @return void
116 + */
117 + public function set_aioseo_helper( Aioseo_Helper $aioseo_helper ) {
118 + $this->aioseo_helper = $aioseo_helper;
119 + }
120 +
121 + /**
103 122 * The name of the plugin we import from.
104 123 *
105 124 * @return string The plugin we import from.
106 125 *
@@ -106,9 +125,9 @@
106 125 *
107 126 * @throws Exception If the PLUGIN constant is not set in the child class.
108 127 */
109 128 public function get_plugin() {
110 - $class = get_class( $this );
129 + $class = static::class;
111 130 $plugin = $class::PLUGIN;
112 131
113 132 if ( $plugin === null ) {
114 133 throw new Exception( 'Importing action without explicit plugin' );
@@ -124,9 +143,9 @@
124 143 *
125 144 * @throws Exception If the TYPE constant is not set in the child class.
126 145 */
127 146 public function get_type() {
128 - $class = get_class( $this );
147 + $class = static::class;
129 148 $type = $class::TYPE;
130 149
131 150 if ( $type === null ) {
132 151 throw new Exception( 'Importing action without explicit type' );
@@ -137,10 +156,10 @@
137 156
138 157 /**
139 158 * Can the current action import the data from plugin $plugin of type $type?
140 159 *
141 - * @param string $plugin The plugin to import from.
142 - * @param string $type The type of data to import.
160 + * @param string|null $plugin The plugin to import from.
161 + * @param string|null $type The type of data to import.
143 162 *
144 163 * @return bool True if this action can handle the combination of Plugin and Type.
145 164 *
146 165 * @throws Exception If the TYPE constant is not set in the child class.
@@ -190,9 +209,9 @@
190 209 * Stores the current state of completedness.
191 210 *
192 211 * @param bool $completed Whether the importer is completed.
193 212 *
194 - * @return void.
213 + * @return void
195 214 */
196 215 public function set_completed( $completed ) {
197 216 $completed_id = $this->get_completed_id();
198 217 $current_importers_completions = $this->options->get( 'importing_completed', [] );