Page MenuHomeDevCentral

No OneTemporary

diff --git a/app/Actions/ActionsReport.php b/app/Actions/ActionsReport.php
index 7e7b4ea..9893fbf 100644
--- a/app/Actions/ActionsReport.php
+++ b/app/Actions/ActionsReport.php
@@ -1,114 +1,111 @@
<?php
namespace Nasqueron\Notifications\Actions;
-use Nasqueron\Notifications\Events\ReportEvent;
-
-use Event;
use Response;
class ActionsReport {
/**
* List of actions
*
* @var Action[]
*/
public $actions = [];
/**
* Report created date
*
* @var int
*/
public $created;
/**
* The entry gate
*
* @var string
*/
public $gate;
/**
* The entry door
*
* @var string
*/
public $door;
/**
* Initializes a new instance of an actions report
*/
public function __construct () {
$this->created = time();
}
///
/// Properties
///
/**
* Sets the gate and the door for this report
*
* @param string $gate The gate
* @param string $door The door
*/
public function attachToGate ($gate, $door) {
$this->gate = $gate;
$this->door = $door;
}
/**
* Adds an action to the list of actions to report
*
* @param Action $action The action to add
*/
public function addAction (Action $action) {
$this->actions[] = $action;
}
/**
* Determines if one of the action has failed.
*
* @return bool
*/
public function containsError () {
foreach ($this->actions as $action) {
if ($action->error !== null) {
return true;
}
}
return false;
}
///
/// Output
///
/**
* Gets a JSON string representation of the current instance
*/
public function __toString () {
return json_encode($this, JSON_PRETTY_PRINT);
}
/**
* Renders the report
*
* @return Illuminate\Http\Response
*/
public function render () {
return Response::json($this)
->setStatusCode($this->getResponseStatusCode());
}
/**
* Determines the HTTP status code of the response
*
* @return int 200 if all is fine, 503 if an error is present
*/
public function getResponseStatusCode () {
return $this->containsError() ? 503 : 200;
}
}

File Metadata

Mime Type
text/x-diff
Expires
Mon, Sep 15, 05:10 (5 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2983734
Default Alt Text
(2 KB)

Event Timeline