<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nekoos-pood / camelcase-arrayobject-mutator example snippets
composer
use NekoOs\Pood\Support\CamelCaseArrayObjectMutator;
$thing = new CamelCaseArrayObjectMutator([
'this is first item with increment key',
'associative-key' => 'this is item with associative key'
]);
$thing->snake_case = 'this is item with key using snake case';
$thing['kebab-case'] = 'this is item with key using kebab case';
$thing[] = 'this is item with key using increment key';
$thing['snake_case'] // return 'this is item with key using snake case'
$thing['kebab-case'] // return 'this is item with key using kebab case'
$thing[0] // return 'this is first item with increment key'
$thing[1] // return 'this is item with key using increment key'
$thing['kebab-case'] // return 'this is item with key using kebab case'
$thing['snakeCase'] // return 'this is item with key using snake case'
$thing['kebabCase'] // return 'this is item with key using kebab case'
$thing->snake_case // return 'this is item with key using snake case'
$thing->snakeCase // return 'this is item with key using snake case'
$thing->kebabCase // return 'this is item with key using kebab case'
$thing->undefined // throw error 'Undefined property: NekoOs\Pood\Support\CamelCaseArrayObjectMutator::$undefined'
get_object_vars($thing) // return array (
// 'associativeKey' => 'this is item with associative key',
// 'snakeCase' => 'this is item with key using snake case',
// 'kebabCase' => 'this is item with key using kebab case',
// )
$thing->snakeCase = 'replace value with key using snake case'
$thing['kebabCase'] = 'replace value with key using kebab case'
$thing['snake_case'] // return 'replace value with key using snake case'
$thing['kebab-case'] // return 'replace value with key using kebab case'
$thing['snakeCase'] // return 'replace value with key using snake case'
$thing['kebabCase'] // return 'replace value with key using kebab case'
$thing->snake_case // return 'replace value with key using snake case'
$thing->snakeCase // return 'replace value with key using snake case'
$thing->kebabCase // return 'replace value with key using kebab case'
$thing->getStorage()
// change behavior from instance as object common without mutation of keys
$thing->behavior(CamelCaseArrayObjectMutator::PREFER_ORIGINAL_KEYS);
get_object_vars($thing) // return array (
// 'associative-key' => 'this is item with associative key',
// 'snake_case' => 'this is item with key using snake case',
// 'kebab-case' => 'this is item with key using kebab case',
// )
// change behavior by default as object common without mutation of keys
CamelCaseArrayObjectMutator::defaultBehavior(CamelCaseArrayObjectMutator::PREFER_ORIGINAL_KEYS);
// Enabled throw errors by default on undefined fields
CamelCaseArrayObjectMutator::defaultBehavior(CamelCaseArrayObjectMutator::DEBUG_ON_UNDEFINDED);
// Disabled throw errors by default on undefined fields
CamelCaseArrayObjectMutator::defaultBehavior(~CamelCaseArrayObjectMutator::DEBUG_ON_UNDEFINDED);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.