WP_CLI\Traverser
RecursiveDataStructureTraverser::create_key
Create the key on the current data.
Метод класса: RecursiveDataStructureTraverser{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->create_key();
Код RecursiveDataStructureTraverser::create_key() RecursiveDataStructureTraverser::create key WP-CLI 2.13.0-alpha
protected function create_key() {
if ( is_array( $this->data ) ) {
$this->data[ $this->key ] = null;
} elseif ( is_object( $this->data ) ) {
$this->data->{$this->key} = null;
} else {
$type = gettype( $this->data );
throw new UnexpectedValueException(
"Cannot create key \"{$this->key}\" on data type {$type}"
);
}
}