Start working on the commands

This commit is contained in:
Joseph Cohen
2015-08-03 12:51:00 -05:00
committed by James Brooks
parent 77ce0e21f4
commit 11b4ab5c6c
6 changed files with 312 additions and 0 deletions
@@ -0,0 +1,70 @@
<?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\Commands\Incident;
class ReportIncidentCommand
{
/**
* The incident name.
*
* @var string
*/
public $name;
/**
* The incident status.
*
* @var int
*/
public $status;
/**
* The incident message.
*
* @var string
*/
public $message;
/**
* The incident visibility.
*
* @var int
*/
public $visible;
/**
* The incident component.
*
* @var int
*/
public $component;
/**
* Create a new report incident command instance.
*
* @param string $name
* @param int $status
* @param string $message
* @param int $visible
* @param int $component
*
* @return void
*/
public function __construct($name, $status, $message, $visible, $component)
{
$this->name = $name;
$this->status = $status;
$this->message = $message;
$this->visible = $visible;
$this->component = $component;
}
}
@@ -0,0 +1,78 @@
<?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\Commands\Metric;
class AddNewMetricCommand
{
/**
* The metric name.
*
* @var string
*/
public $name;
/**
* The metric suffix.
*
* @var string
*/
public $suffix;
/**
* The metric description.
*
* @var string
*/
public $description;
/**
* The metric default value.
*
* @var float
*/
public $default;
/**
* The metric calc type.
*
* @var int
*/
public $type;
/**
* The metric display chart.
*
* @var int
*/
public $chart;
/**
* Create a new add team member command instance.
*
* @param string $name
* @param string $suffix
* @param string $description
* @param float $default
* @param int $type
* @param int $chart
*
* @return void
*/
public function __construct($name, $suffix, $description, $default, $type, $chart)
{
$this->name = $name;
$this->suffix = $suffix;
$this->description = $description;
$this->default = $default;
$this->chart = $chart;
}
}
@@ -0,0 +1,34 @@
<?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\Commands\Subscriber;
class SubscribeCustomerCommand
{
/**
* The customer email.
*
* @var string
*/
public $email;
/**
* Create a new subscribe customer command instance.
*
* @param string $email
*
* @return void
*/
public function __construct($email)
{
$this->email = $email;
}
}
@@ -0,0 +1,61 @@
<?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\Commands\User;
class AddTeamMemberCommand
{
/**
* The user username.
*
* @var string
*/
public $username;
/**
* The user password.
*
* @var string
*/
public $password;
/**
* The user email.
*
* @var string
*/
public $email;
/**
* The user level.
*
* @var int
*/
public $level;
/**
* Create a new add team member command instance.
*
* @param string $username
* @param string $password
* @param string $email
* @param int $level
*
* @return void
*/
public function __construct($username, $password, $email, $level)
{
$this->username = $username;
$this->password = $password;
$this->email = $email;
$this->level = $level;
}
}
@@ -0,0 +1,34 @@
<?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\Commands\User;
class GenerateApiTokenCommand
{
/**
* The user to generate the token.
*
* @var \CachetHQ\Cachet\Models\User
*/
public $user;
/**
* Create a new generate api token command instance.
*
* @param \CachetHQ\Cachet\Models\User $user
*
* @return void
*/
public function __construct($user)
{
$this->user = $user;
}
}
@@ -0,0 +1,35 @@
<?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\Handlers\Commands\User;
use CachetHQ\Cachet\Commands\GenerateApiTokenCommand;
use CachetHQ\Cachet\Models\User;
class GenerateApiTokenCommandHandler
{
/**
* Handle the generate api key command.
*
* @param \CachetHQ\Cachet\Commands\GenerateApiTokenCommand $command
*
* @return void
*/
public function handle(GenerateApiTokenCommand $command)
{
$user = $command->user;
$user->api_key = User::generateApiKey();
$user->save();
//event(new GeneratedApiTokenEvent($user));
}
}