Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/wordpres.../src/surfaces
File: schema-helpers-surface.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Surfaces;
[2] Fix | Delete
[3] Fix | Delete
use Yoast\WP\SEO\Exceptions\Forbidden_Property_Mutation_Exception;
[4] Fix | Delete
use Yoast\WP\SEO\Helpers\Schema;
[5] Fix | Delete
use YoastSEO_Vendor\Symfony\Component\DependencyInjection\ContainerInterface;
[6] Fix | Delete
[7] Fix | Delete
/**
[8] Fix | Delete
* Class Schema_Helpers_Surface.
[9] Fix | Delete
*
[10] Fix | Delete
* Surface for the indexables.
[11] Fix | Delete
*
[12] Fix | Delete
* @property Schema\Article_Helper $article
[13] Fix | Delete
* @property Schema\HTML_Helper $html
[14] Fix | Delete
* @property Schema\ID_Helper $id
[15] Fix | Delete
* @property Schema\Image_Helper $image
[16] Fix | Delete
* @property Schema\Language_Helper $language
[17] Fix | Delete
*/
[18] Fix | Delete
class Schema_Helpers_Surface {
[19] Fix | Delete
[20] Fix | Delete
/**
[21] Fix | Delete
* The DI container.
[22] Fix | Delete
*
[23] Fix | Delete
* @var ContainerInterface
[24] Fix | Delete
*/
[25] Fix | Delete
private $container;
[26] Fix | Delete
[27] Fix | Delete
/**
[28] Fix | Delete
* Helpers that should be fully capitalized.
[29] Fix | Delete
*
[30] Fix | Delete
* @var array
[31] Fix | Delete
*/
[32] Fix | Delete
private $capitalized_helpers = [ 'html', 'id' ];
[33] Fix | Delete
[34] Fix | Delete
/**
[35] Fix | Delete
* Loader constructor.
[36] Fix | Delete
*
[37] Fix | Delete
* @param ContainerInterface $container The dependency injection container.
[38] Fix | Delete
*/
[39] Fix | Delete
public function __construct( ContainerInterface $container ) {
[40] Fix | Delete
$this->container = $container;
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
/**
[44] Fix | Delete
* Magic getter for getting helper classes.
[45] Fix | Delete
*
[46] Fix | Delete
* @param string $helper The helper to get.
[47] Fix | Delete
*
[48] Fix | Delete
* @return mixed The helper class.
[49] Fix | Delete
*/
[50] Fix | Delete
public function __get( $helper ) {
[51] Fix | Delete
return $this->container->get( $this->get_helper_class( $helper ) );
[52] Fix | Delete
}
[53] Fix | Delete
[54] Fix | Delete
/**
[55] Fix | Delete
* Magic isset for ensuring helper exists.
[56] Fix | Delete
*
[57] Fix | Delete
* @param string $helper The helper to get.
[58] Fix | Delete
*
[59] Fix | Delete
* @return bool Whether the helper exists.
[60] Fix | Delete
*/
[61] Fix | Delete
public function __isset( $helper ) {
[62] Fix | Delete
return $this->container->has( $this->get_helper_class( $helper ) );
[63] Fix | Delete
}
[64] Fix | Delete
[65] Fix | Delete
/**
[66] Fix | Delete
* Prevents setting dynamic properties and unsetting declared properties
[67] Fix | Delete
* from an inaccessible context.
[68] Fix | Delete
*
[69] Fix | Delete
* @param string $name The property name.
[70] Fix | Delete
* @param mixed $value The property value.
[71] Fix | Delete
*
[72] Fix | Delete
* @return void
[73] Fix | Delete
*
[74] Fix | Delete
* @throws Forbidden_Property_Mutation_Exception Set is never meant to be called.
[75] Fix | Delete
*/
[76] Fix | Delete
public function __set( $name, $value ) { // @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed -- __set must have a name and value - PHPCS #3715.
[77] Fix | Delete
throw Forbidden_Property_Mutation_Exception::cannot_set_because_property_is_immutable( $name );
[78] Fix | Delete
}
[79] Fix | Delete
[80] Fix | Delete
/**
[81] Fix | Delete
* Prevents unsetting dynamic properties and unsetting declared properties
[82] Fix | Delete
* from an inaccessible context.
[83] Fix | Delete
*
[84] Fix | Delete
* @param string $name The property name.
[85] Fix | Delete
*
[86] Fix | Delete
* @return void
[87] Fix | Delete
*
[88] Fix | Delete
* @throws Forbidden_Property_Mutation_Exception Unset is never meant to be called.
[89] Fix | Delete
*/
[90] Fix | Delete
public function __unset( $name ) {
[91] Fix | Delete
throw Forbidden_Property_Mutation_Exception::cannot_unset_because_property_is_immutable( $name );
[92] Fix | Delete
}
[93] Fix | Delete
[94] Fix | Delete
/**
[95] Fix | Delete
* Get the class name from a helper slug
[96] Fix | Delete
*
[97] Fix | Delete
* @param string $helper The name of the helper.
[98] Fix | Delete
*
[99] Fix | Delete
* @return string
[100] Fix | Delete
*/
[101] Fix | Delete
protected function get_helper_class( $helper ) {
[102] Fix | Delete
if ( \in_array( $helper, $this->capitalized_helpers, true ) ) {
[103] Fix | Delete
$helper = \strtoupper( $helper );
[104] Fix | Delete
}
[105] Fix | Delete
$helper = \implode( '_', \array_map( 'ucfirst', \explode( '_', $helper ) ) );
[106] Fix | Delete
return "Yoast\WP\SEO\Helpers\Schema\\{$helper}_Helper";
[107] Fix | Delete
}
[108] Fix | Delete
}
[109] Fix | Delete
[110] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function