Inpsyde\MultilingualPress\Core\Exception\PropertyManipulationNotAllowedException::for_name PHP Method

for_name() public static method

Returns a new exception object.
Since: 3.0.0
public static for_name ( string $name, string $action = 'set' ) : static
$name string The name of the property.
$action string Optional. Action to be performed. Defaults to 'set'.
return static Exception object.
    public static function for_name($name, $action = 'set')
    {
        return new static(sprintf('Cannot %2$s "%1$s". Manipulating a property is not allowed.', $name, $action));
    }

Usage Example

 /**
  * Removes the property with the given name.
  *
  * Removing properties is not allowed.
  *
  * @since 3.0.0
  *
  * @param string $name The name of a property.
  *
  * @return void
  *
  * @throws PropertyManipulationNotAllowedException
  */
 public function offsetUnset($name)
 {
     throw PropertyManipulationNotAllowedException::for_name($name, 'unset');
 }
PropertyManipulationNotAllowedException