Skip to content

Commit

Permalink
Reformate
Browse files Browse the repository at this point in the history
  • Loading branch information
vanchelo committed Feb 20, 2016
1 parent fcb0925 commit 8b694c3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
17 changes: 7 additions & 10 deletions src/Body.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class Body implements Arrayable, Jsonable
* ReponseData constructor.
*
* @param string $message
* @param bool $success
* @param array $data
* @param bool $success
* @param array $data
*/
public function __construct($message = '', $success = true, array $data = [])
{
Expand Down Expand Up @@ -85,18 +85,15 @@ public function message($message)
* Set response data
*
* @param array $data
* @param bool $merge
* @param bool $merge
*
* @return self
*/
public function data($data, $merge = false)
{
if ($merge)
{
if ($merge) {
$this->data = array_merge($this->data, $data);
}
else
{
} else {
$this->data += $data;
}

Expand All @@ -112,8 +109,8 @@ public function toArray()
{
return [
'success' => $this->success,
'error' => ! $this->success,
'message' => $this->message
'error' => !$this->success,
'message' => $this->message,
] + $this->data;
}

Expand Down
13 changes: 6 additions & 7 deletions src/MyAjaxResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ class MyAjaxResponse extends AjaxResponse
*
* @return $this
*/
function __call($name, $arguments)
public function __call($name, $arguments)
{
if (count($arguments) == 1)
{
if (count($arguments) == 1) {
$this->body[$name] = $arguments[0];
}
else if (count($arguments) > 1)
{
$this->body[$name] = $arguments;
} else {
if (count($arguments) > 1) {
$this->body[$name] = $arguments;
}
}

return $this;
Expand Down
5 changes: 2 additions & 3 deletions src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ public function send()
return parent::send();
}

function __call($name, $arguments)
public function __call($name, $arguments)
{
if (method_exists($this->body, $name))
{
if (method_exists($this->body, $name)) {
call_user_func_array([$this->body, $name], $arguments);

return $this;
Expand Down

0 comments on commit 8b694c3

Please sign in to comment.