Skip to content

Commit

Permalink
Merge pull request #7 from CachetHQ/2.4
Browse files Browse the repository at this point in the history
Update from upstream repo CachetHQ/Cachet
  • Loading branch information
billmn committed Oct 7, 2016
2 parents 315e4cc + 42713f5 commit bc4d1a0
Show file tree
Hide file tree
Showing 63 changed files with 1,929 additions and 120 deletions.
41 changes: 41 additions & 0 deletions app/Bus/Commands/IncidentUpdate/RemoveIncidentUpdateCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace CachetHQ\Cachet\Bus\Commands\IncidentUpdate;

use CachetHQ\Cachet\Models\IncidentUpdate;

/**
* This is the remove incident update command.
*
* @author James Brooks <[email protected]>
*/
final class RemoveIncidentUpdateCommand
{
/**
* The incident update to remove.
*
* @var \CachetHQ\Cachet\Models\IncidentUpdate
*/
public $incidentUpdate;

/**
* Create a new remove incident update command instance.
*
* @param \CachetHQ\Cachet\Models\IncidentUpdate $incidentUpdate
*
* @return void
*/
public function __construct(IncidentUpdate $incidentUpdate)
{
$this->incidentUpdate = $incidentUpdate;
}
}
81 changes: 81 additions & 0 deletions app/Bus/Commands/IncidentUpdate/ReportIncidentUpdateCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php

/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace CachetHQ\Cachet\Bus\Commands\IncidentUpdate;

use CachetHQ\Cachet\Models\Incident;
use CachetHQ\Cachet\Models\User;

/**
* This is the report incident update command.
*
* @author James Brooks <[email protected]>
*/
final class ReportIncidentUpdateCommand
{
/**
* The incident.
*
* @var \CachetHQ\Cachet\Models\Incident
*/
public $incident;

/**
* The incident status.
*
* @var int
*/
public $status;

/**
* The incident message.
*
* @var string
*/
public $message;

/**
* The user.
*
* @var \CachetHQ\Cachet\Models\User
*/
public $user;

/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'incident' => 'required',
'status' => 'required|int|min:1|max:4',
'message' => 'required|string',
'user' => 'required',
];

/**
* Create a new report incident update command instance.
*
* @param \CachetHQ\Cachet\Models\Incident $incident
* @param string $status
* @param string $message
* @param \CachetHQ\Cachet\Models\User $user
*
* @return void
*/
public function __construct(Incident $incident, $status, $message, User $user)
{
$this->incident = $incident;
$this->status = $status;
$this->message = $message;
$this->user = $user;
}
}
81 changes: 81 additions & 0 deletions app/Bus/Commands/IncidentUpdate/UpdateIncidentUpdateCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php

/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace CachetHQ\Cachet\Bus\Commands\IncidentUpdate;

use CachetHQ\Cachet\Models\IncidentUpdate;
use CachetHQ\Cachet\Models\User;

/**
* This is the update incident update command.
*
* @author James Brooks <[email protected]>
*/
final class UpdateIncidentUpdateCommand
{
/**
* The incident update.
*
* @var \CachetHQ\Cachet\Models\IncidentUpdate
*/
public $update;

/**
* The incident status.
*
* @var int
*/
public $status;

/**
* The incident message.
*
* @var string
*/
public $message;

/**
* The user.
*
* @var \CachetHQ\Cachet\Models\User
*/
public $user;

/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'update' => 'required',
'status' => 'int|min:1|max:4',
'message' => 'string',
'user' => 'required',
];

/**
* Create a new update incident update command instance.
*
* @param \CachetHQ\Cachet\Models\IncidentUpdate $update
* @param string $status
* @param string $message
* @param \CachetHQ\Cachet\Models\User $user
*
* @return void
*/
public function __construct(IncidentUpdate $update, $status, $message, User $user)
{
$this->update = $update;
$this->status = $status;
$this->message = $message;
$this->user = $user;
}
}
24 changes: 24 additions & 0 deletions app/Bus/Events/IncidentUpdate/IncidentUpdateEventInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace CachetHQ\Cachet\Bus\Events\IncidentUpdate;

use CachetHQ\Cachet\Bus\Events\EventInterface;

/**
* This is the incident update event interface.
*
* @author James Brooks <[email protected]>
*/
interface IncidentUpdateEventInterface extends EventInterface
{
//
}
41 changes: 41 additions & 0 deletions app/Bus/Events/IncidentUpdate/IncidentUpdateWasRemovedEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace CachetHQ\Cachet\Bus\Events\IncidentUpdate;

use CachetHQ\Cachet\Models\IncidentUpdate;

/**
* This is the incident update was removed event.
*
* @author James Brooks <[email protected]>
*/
final class IncidentUpdateWasRemovedEvent implements IncidentUpdateEventInterface
{
/**
* The incident update that has been removed.
*
* @var \CachetHQ\Cachet\Models\IncidentUpdate
*/
public $update;

/**
* Create a new incident update was removed event instance.
*
* @param \CachetHQ\Cachet\Models\IncidentUpdate $update
*
* @return void
*/
public function __construct(IncidentUpdate $update)
{
$this->update = $update;
}
}
41 changes: 41 additions & 0 deletions app/Bus/Events/IncidentUpdate/IncidentUpdateWasReportedEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace CachetHQ\Cachet\Bus\Events\IncidentUpdate;

use CachetHQ\Cachet\Models\IncidentUpdate;

/**
* This is the incident update was reported event.
*
* @author James Brooks <[email protected]>
*/
final class IncidentUpdateWasReportedEvent implements IncidentUpdateEventInterface
{
/**
* The incident update that has been reported.
*
* @var \CachetHQ\Cachet\Models\IncidentUpdate
*/
public $update;

/**
* Create a new incident update was reported event instance.
*
* @param \CachetHQ\Cachet\Models\IncidentUpdate $update
*
* @return void
*/
public function __construct(IncidentUpdate $update)
{
$this->update = $update;
}
}
41 changes: 41 additions & 0 deletions app/Bus/Events/IncidentUpdate/IncidentUpdateWasUpdatedEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace CachetHQ\Cachet\Bus\Events\IncidentUpdate;

use CachetHQ\Cachet\Models\IncidentUpdate;

/**
* This is the incident update was updated event.
*
* @author James Brooks <[email protected]>
*/
final class IncidentUpdateWasUpdatedEvent implements IncidentUpdateEventInterface
{
/**
* The incident update that has been updated.
*
* @var \CachetHQ\Cachet\Models\IncidentUpdate
*/
public $update;

/**
* Create a new incident update was updated event instance.
*
* @param \CachetHQ\Cachet\Models\IncidentUpdate $update
*
* @return void
*/
public function __construct(IncidentUpdate $update)
{
$this->update = $update;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace CachetHQ\Cachet\Bus\Handlers\Commands\IncidentUpdate;

use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\RemoveIncidentUpdateCommand;
use CachetHQ\Cachet\Bus\Events\IncidentUpdate\IncidentUpdateWasRemovedEvent;

/**
* This is the remove incident update command handler.
*
* @author James Brooks <[email protected]>
*/
class RemoveIncidentUpdateCommandHandler
{
/**
* Handle the remove incident update command.
*
* @param \CachetHQ\Cachet\Bus\Commands\IncidentUpdate\RemoveIncidentUpdateCommand $command
*
* @return void
*/
public function handle(RemoveIncidentUpdateCommand $command)
{
$update = $command->incidentUpdate;

event(new IncidentUpdateWasRemovedEvent($update));

$update->delete();
}
}
Loading

0 comments on commit bc4d1a0

Please sign in to comment.