Overview

Namespaces

  • Knot
    • Dict
      • Helpers
    • Exceptions
  • None

Classes

  • Knot\Dict
  • Knot\Dict\AbstractDictBody
  • Knot\Dict\ChildDict
  • Knot\Dict\HelperManager
  • Knot\Dict\Helpers\AbstractPHPArrayHelper
  • Knot\Dict\Helpers\PHPArrayChangerHelper
  • Knot\Dict\Helpers\PHPArrayEqualizerHelper
  • Knot\Dict\Helpers\UnderscoreHelper
  • Knot\Dict\ParentDict

Interfaces

  • Knot\Dict\Helpers\HelperInterface

Traits

  • Knot\Dict\ArrayAccessTrait
  • Knot\Dict\CountableTrait
  • Knot\Dict\IteratorAggregateTrait
  • Knot\Dict\PathOperationsTrait

Exceptions

  • Knot\Exceptions\FunctionExecuteException
  • Knot\Exceptions\WrongArrayPathException
  • Knot\Exceptions\WrongFunctionException

Functions

  • ar
  • arr
  • arrRef
  • is_dict
  • Overview
  • Namespace
  • Class
 1: <?php namespace Knot\Dict\Helpers;
 2: 
 3: use Knot\Dict\AbstractDictBody;
 4: use Knot\Dict\HelperManager;
 5: 
 6: /*
 7:  * This helper method's returns changed data.
 8:  */
 9: 
10: class PHPArrayChangerHelper extends AbstractPHPArrayHelper implements HelperInterface {
11: 
12:     public $functions = [
13:         "array_multisort",
14:         "array_pop",
15:         "array_product",
16:         "array_push",
17:         "array_rand",
18:         "array_reduce",
19:         "array_shift",
20:         "array_splice",
21:         "array_sum",
22:         "array_unshift",
23:         "array_walk_recursive",
24:         "array_walk"
25:     ];
26: 
27: 
28:     public function getName()
29:     {
30:         return "phparraychangerhelper";
31:     }
32: 
33: 
34:     public function addRoutes(HelperManager $helperManager)
35:     {
36:         foreach ($this->functions as $functionName)
37:         {
38:             $route = $this->convertPHPFunctionToRoute($functionName);
39:             $helperManager->addRoute($route, [ __CLASS__, "execute" ]);
40:         }
41:     }
42: 
43: 
44:     public static function execute(AbstractDictBody $knot, $arguments, $methodName)
45:     {
46:         $methodName = self::convertRouteToPHPFunction($methodName);
47:         $data       =& $knot->toArray();
48: 
49:         return call_user_func_array($methodName, array_merge([ &$data ], $arguments));
50:     }
51: }
API documentation generated by ApiGen