| 1 |
<?php |
| 2 |
|
| 3 |
namespace Yoast\WP\SEO\Values\Robots; |
| 4 |
|
| 5 |
/** |
| 6 |
* Class Directive |
| 7 |
*/ |
| 8 |
class Directive { |
| 9 |
|
| 10 |
/** |
| 11 |
* Paths list. |
| 12 |
* |
| 13 |
* @var array All paths affected by this directive. |
| 14 |
*/ |
| 15 |
private $paths; |
| 16 |
|
| 17 |
/** |
| 18 |
* Sets up the path array |
| 19 |
*/ |
| 20 |
public function __construct() { |
| 21 |
$this->paths = []; |
| 22 |
} |
| 23 |
|
| 24 |
/** |
| 25 |
* Adds a path to the directive path list. |
| 26 |
* |
| 27 |
* @param string $path A path to add in the path list. |
| 28 |
* |
| 29 |
* @return void |
| 30 |
*/ |
| 31 |
public function add_path( $path ) { |
| 32 |
if ( ! \in_array( $path, $this->paths, true ) ) { |
| 33 |
$this->paths[] = $path; |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
/** |
| 38 |
* Returns all paths. |
| 39 |
* |
| 40 |
* @return array |
| 41 |
*/ |
| 42 |
public function get_paths() { |
| 43 |
return $this->paths; |
| 44 |
} |
| 45 |
} |
| 46 |
|