/**
  * @return \Owebia\ShippingCore\Model\Wrapper\ArrayWrapper
  * @throws \Exception
  */
 public function addMethod()
 {
     $args = func_get_args();
     if (count($args) != 2) {
         throw new \Exception("Invalid arguments count for addMethod FuncCall");
     }
     $methodId = array_shift($args);
     if (!is_string($methodId) || !preg_match('#^[a-z][a-z0-9_]*$#', $methodId)) {
         throw new \Exception("Invalid first argument for addMethod FuncCall: the first argument" . " must be a string and match the following pattern : ^[a-z][a-z0-9_]*\$");
     }
     $methodOptions = array_shift($args);
     if (!is_array($methodOptions)) {
         throw new \Exception("Invalid second argument for addMethod FuncCall:" . " the second argument must be an array");
     }
     $this->result[$methodId] = (object) $methodOptions;
     return $this->registry->create('ArrayWrapper', ['data' => $methodOptions]);
 }
 /**
  * @param mixed $data
  * @param string $className
  * @return \Owebia\ShippingCore\Model\Wrapper\AbstractWrapper
  */
 protected function createWrapper($data, $className = 'SourceWrapper')
 {
     return $this->registry->create($className, ['data' => $data]);
 }