Automattic\WooCommerce\Vendor\League\Container\Inflector

Inflector::inflect()publicWC 1.0

{@inheritdoc}

Method of the class: Inflector{}

No Hooks.

Return

null. Nothing (null).

Usage

$Inflector = new Inflector();
$Inflector->inflect( $object );
$object (required)
-

Inflector::inflect() code WC 8.7.0

public function inflect($object)
{
    $properties = $this->resolveArguments(array_values($this->properties));
    $properties = array_combine(array_keys($this->properties), $properties);

    // array_combine() can technically return false
    foreach ($properties ?: [] as $property => $value) {
        $object->{$property} = $value;
    }

    foreach ($this->methods as $method => $args) {
        $args = $this->resolveArguments($args);

        /** @var callable $callable */
        $callable = [$object, $method];
        call_user_func_array($callable, $args);
    }

    if ($this->callback !== null) {
        call_user_func($this->callback, $object);
    }
}