Inpsyde\MultilingualPress\Common\Factory::create PHP Метод

create() публичный Метод

Returns a new object of the given (or default) class, instantiated with the given arguments.
С версии: 3.0.0
public create ( array $args = [], string $class = '' ) : object
$args array Optional. Constructor arguments. Defaults to empty array.
$class string Optional. Fully qualified class name. Defaults to empty string.
Результат object Object of the given (or default) class, instantiated with the given arguments.
    public function create(array $args = [], $class = '');

Usage Example

 /**
  * Returns a new WordPress error object, instantiated with the given arguments.
  *
  * @since 3.0.0
  *
  * @param array  $args  Optional. Constructor arguments. Defaults to empty array.
  * @param string $class Optional. Fully qualified class name. Defaults to empty string.
  *
  * @return WP_Error WordPress error object.
  *
  * @throws Exception if caught any and WP_DEBUG is set to true.
  */
 public function create(array $args = [], $class = '')
 {
     try {
         $object = $this->factory->create($args, (string) $class);
     } catch (Exception $e) {
         if (defined('WP_DEBUG') && WP_DEBUG) {
             throw $e;
         }
         return $this->factory->create($args, ErrorFactory::DEFAULT_CLASS);
     }
     return $object;
 }
Factory