13 protected function build($config, array $options)
15 $operations = array();
16 if (!empty($config[
'operations'])) {
17 foreach ($config[
'operations'] as $name =>
$op) {
18 $name =
$op[
'name'] = isset(
$op[
'name']) ?
$op[
'name'] : $name;
20 if (!empty(
$op[
'extends'])) {
23 $op[
'parameters'] = isset(
$op[
'parameters']) ?
$op[
'parameters'] : array();
24 $operations[$name] =
$op;
29 'apiVersion' => isset($config[
'apiVersion']) ? $config[
'apiVersion'] :
null,
30 'baseUrl' => isset($config[
'baseUrl']) ? $config[
'baseUrl'] :
null,
31 'description' => isset($config[
'description']) ? $config[
'description'] :
null,
32 'operations' => $operations,
33 'models' => isset($config[
'models']) ? $config[
'models'] :
null
46 $original = empty(
$op[
'parameters']) ?
false:
$op[
'parameters'];
47 $hasClass = !empty(
$op[
'class']);
48 foreach ((array)
$op[
'extends'] as $extendedCommand) {
49 if (empty($operations[$extendedCommand])) {
52 $toArray = $operations[$extendedCommand];
53 $resolved = empty($resolved)
54 ? $toArray[
'parameters']
55 : array_merge($resolved, $toArray[
'parameters']);
58 if (!$hasClass && isset($toArray[
'class'])) {
59 $op[
'class'] = $toArray[
'class'];
62 $op[
'parameters'] = $original ? array_merge($resolved, $original) : $resolved;