Apply fixes from StyleCI

This commit is contained in:
Daniil Gentili 2017-07-27 15:30:17 +00:00 committed by StyleCI Bot
parent 5e9df575da
commit 5e549b92e7
2 changed files with 17 additions and 4 deletions

View File

@ -39,7 +39,9 @@ class TLConstructor extends \Volatile
$this->by_id[$json_dict['id']]['layer'] = $json_dict['layer']; $this->by_id[$json_dict['id']]['layer'] = $json_dict['layer'];
$this->layers[$json_dict['layer']] = $json_dict['layer']; $this->layers[$json_dict['layer']] = $json_dict['layer'];
ksort($this->layers); ksort($this->layers);
} else $json_dict['layer'] = ''; } else {
$json_dict['layer'] = '';
}
$this->by_predicate_and_layer[$json_dict['predicate'].$json_dict['layer']] = $json_dict['id']; $this->by_predicate_and_layer[$json_dict['predicate'].$json_dict['layer']] = $json_dict['id'];
$this->parse_params($json_dict['id'], $scheme_type === 'mtproto'); $this->parse_params($json_dict['id'], $scheme_type === 'mtproto');
} }
@ -50,9 +52,11 @@ class TLConstructor extends \Volatile
if ($constructor['type'] === $type) { if ($constructor['type'] === $type) {
$constructor['id'] = $id; $constructor['id'] = $id;
$constructor['params'] = $this->array_cast_recursive($constructor['params']); $constructor['params'] = $this->array_cast_recursive($constructor['params']);
return $constructor; return $constructor;
} }
} }
return false; return false;
} }
@ -64,18 +68,23 @@ class TLConstructor extends \Volatile
$chosenid = $this->by_predicate_and_layer[$predicate.$alayer]; $chosenid = $this->by_predicate_and_layer[$predicate.$alayer];
} }
} }
if (!isset($chosenid)) return false; if (!isset($chosenid)) {
return false;
}
$constructor = $this->by_id[$chosenid]; $constructor = $this->by_id[$chosenid];
$constructor['id'] = $chosenid; $constructor['id'] = $chosenid;
$constructor['params'] = $this->array_cast_recursive($constructor['params']); $constructor['params'] = $this->array_cast_recursive($constructor['params']);
return $constructor; return $constructor;
} }
if (isset($this->by_predicate_and_layer[$predicate])) { if (isset($this->by_predicate_and_layer[$predicate])) {
$constructor = $this->by_id[$this->by_predicate_and_layer[$predicate]]; $constructor = $this->by_id[$this->by_predicate_and_layer[$predicate]];
$constructor['id'] = $this->by_predicate_and_layer[$predicate]; $constructor['id'] = $this->by_predicate_and_layer[$predicate];
$constructor['params'] = $this->array_cast_recursive($constructor['params']); $constructor['params'] = $this->array_cast_recursive($constructor['params']);
return $constructor; return $constructor;
} }
return false; return false;
} }
@ -85,8 +94,10 @@ class TLConstructor extends \Volatile
$constructor = $this->by_id[$id]; $constructor = $this->by_id[$id];
$constructor['id'] = $id; $constructor['id'] = $id;
$constructor['params'] = $this->array_cast_recursive($constructor['params']); $constructor['params'] = $this->array_cast_recursive($constructor['params']);
return $constructor; return $constructor;
} }
return false; return false;
} }
} }

View File

@ -39,15 +39,16 @@ class TLMethod extends \Volatile
$this->parse_params($json_dict['id']); $this->parse_params($json_dict['id']);
} }
public function find_by_id($id) public function find_by_id($id)
{ {
if (isset($this->by_id[$id])) { if (isset($this->by_id[$id])) {
$method = $this->by_id[$id]; $method = $this->by_id[$id];
$method['id'] = $id; $method['id'] = $id;
$method['params'] = $this->array_cast_recursive($method['params']); $method['params'] = $this->array_cast_recursive($method['params']);
return $method; return $method;
} }
return false; return false;
} }
@ -57,9 +58,10 @@ class TLMethod extends \Volatile
$method = $this->by_id[$this->by_method[$method_name]]; $method = $this->by_id[$this->by_method[$method_name]];
$method['id'] = $this->by_method[$method_name]; $method['id'] = $this->by_method[$method_name];
$method['params'] = $this->array_cast_recursive($method['params']); $method['params'] = $this->array_cast_recursive($method['params']);
return $method; return $method;
} }
return false; return false;
} }
} }