@@ -6,32 +6,32 @@ |
||
| 6 | 6 | |
| 7 | 7 | class MarkdownParser |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Markdown parser instance. |
|
| 11 | - * |
|
| 12 | - * @var ParsedownExtra |
|
| 13 | - */ |
|
| 14 | - private $markdown; |
|
| 9 | + /** |
|
| 10 | + * Markdown parser instance. |
|
| 11 | + * |
|
| 12 | + * @var ParsedownExtra |
|
| 13 | + */ |
|
| 14 | + private $markdown; |
|
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * MarkdownParser constructor. |
|
| 18 | - * |
|
| 19 | - * @param ParsedownExtra $markdown |
|
| 20 | - */ |
|
| 21 | - public function __construct(ParsedownExtra $markdown) |
|
| 22 | - { |
|
| 23 | - $this->markdown = $markdown; |
|
| 24 | - } |
|
| 16 | + /** |
|
| 17 | + * MarkdownParser constructor. |
|
| 18 | + * |
|
| 19 | + * @param ParsedownExtra $markdown |
|
| 20 | + */ |
|
| 21 | + public function __construct(ParsedownExtra $markdown) |
|
| 22 | + { |
|
| 23 | + $this->markdown = $markdown; |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Parse a markdown document. |
|
| 28 | - * |
|
| 29 | - * @param $path |
|
| 30 | - * |
|
| 31 | - * @return mixed|string |
|
| 32 | - */ |
|
| 33 | - public function parse($path) |
|
| 34 | - { |
|
| 35 | - return $this->markdown->text($path); |
|
| 36 | - } |
|
| 26 | + /** |
|
| 27 | + * Parse a markdown document. |
|
| 28 | + * |
|
| 29 | + * @param $path |
|
| 30 | + * |
|
| 31 | + * @return mixed|string |
|
| 32 | + */ |
|
| 33 | + public function parse($path) |
|
| 34 | + { |
|
| 35 | + return $this->markdown->text($path); |
|
| 36 | + } |
|
| 37 | 37 | } |
@@ -8,33 +8,33 @@ |
||
| 8 | 8 | |
| 9 | 9 | class Registrar implements RegistrarContract |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * Get a validator for an incoming registration request. |
|
| 13 | - * |
|
| 14 | - * @param array $data |
|
| 15 | - * |
|
| 16 | - * @return \Illuminate\Contracts\Validation\Validator |
|
| 17 | - */ |
|
| 18 | - public function validator(array $data) |
|
| 19 | - { |
|
| 20 | - return Validator::make($data, [ |
|
| 21 | - 'email' => 'required|email|max:255|unique:users', |
|
| 22 | - 'password' => 'required|confirmed|min:6', |
|
| 23 | - ]); |
|
| 24 | - } |
|
| 11 | + /** |
|
| 12 | + * Get a validator for an incoming registration request. |
|
| 13 | + * |
|
| 14 | + * @param array $data |
|
| 15 | + * |
|
| 16 | + * @return \Illuminate\Contracts\Validation\Validator |
|
| 17 | + */ |
|
| 18 | + public function validator(array $data) |
|
| 19 | + { |
|
| 20 | + return Validator::make($data, [ |
|
| 21 | + 'email' => 'required|email|max:255|unique:users', |
|
| 22 | + 'password' => 'required|confirmed|min:6', |
|
| 23 | + ]); |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Create a new user instance after a valid registration. |
|
| 28 | - * |
|
| 29 | - * @param array $data |
|
| 30 | - * |
|
| 31 | - * @return User |
|
| 32 | - */ |
|
| 33 | - public function create(array $data) |
|
| 34 | - { |
|
| 35 | - return User::create([ |
|
| 36 | - 'email' => $data['email'], |
|
| 37 | - 'password' => bcrypt($data['password']), |
|
| 38 | - ]); |
|
| 39 | - } |
|
| 26 | + /** |
|
| 27 | + * Create a new user instance after a valid registration. |
|
| 28 | + * |
|
| 29 | + * @param array $data |
|
| 30 | + * |
|
| 31 | + * @return User |
|
| 32 | + */ |
|
| 33 | + public function create(array $data) |
|
| 34 | + { |
|
| 35 | + return User::create([ |
|
| 36 | + 'email' => $data['email'], |
|
| 37 | + 'password' => bcrypt($data['password']), |
|
| 38 | + ]); |
|
| 39 | + } |
|
| 40 | 40 | } |
@@ -7,53 +7,53 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | class Statistics |
| 9 | 9 | { |
| 10 | - /** |
|
| 11 | - * Returns the count of all pokes. |
|
| 12 | - * |
|
| 13 | - * @return mixed |
|
| 14 | - */ |
|
| 15 | - public function totalPokes() |
|
| 16 | - { |
|
| 17 | - $base = 189771; |
|
| 10 | + /** |
|
| 11 | + * Returns the count of all pokes. |
|
| 12 | + * |
|
| 13 | + * @return mixed |
|
| 14 | + */ |
|
| 15 | + public function totalPokes() |
|
| 16 | + { |
|
| 17 | + $base = 189771; |
|
| 18 | 18 | |
| 19 | - return Poke::count() + $base; |
|
| 20 | - } |
|
| 19 | + return Poke::count() + $base; |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * Returns the the count of all devices. |
|
| 24 | - * |
|
| 25 | - * @return mixed |
|
| 26 | - */ |
|
| 27 | - public function totalDevices() |
|
| 28 | - { |
|
| 29 | - return Poke::distinct()->count('mac'); |
|
| 30 | - } |
|
| 22 | + /** |
|
| 23 | + * Returns the the count of all devices. |
|
| 24 | + * |
|
| 25 | + * @return mixed |
|
| 26 | + */ |
|
| 27 | + public function totalDevices() |
|
| 28 | + { |
|
| 29 | + return Poke::distinct()->count('mac'); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Returns all pokes. |
|
| 34 | - * |
|
| 35 | - * @return mixed |
|
| 36 | - */ |
|
| 37 | - public function allPokes() |
|
| 38 | - { |
|
| 39 | - return Poke::select( |
|
| 40 | - DB::raw('count(*) as pokes, date(created_at) as date') |
|
| 41 | - ) |
|
| 42 | - ->groupBy('date') |
|
| 43 | - ->get(); |
|
| 44 | - } |
|
| 32 | + /** |
|
| 33 | + * Returns all pokes. |
|
| 34 | + * |
|
| 35 | + * @return mixed |
|
| 36 | + */ |
|
| 37 | + public function allPokes() |
|
| 38 | + { |
|
| 39 | + return Poke::select( |
|
| 40 | + DB::raw('count(*) as pokes, date(created_at) as date') |
|
| 41 | + ) |
|
| 42 | + ->groupBy('date') |
|
| 43 | + ->get(); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Returns a collection of all networks and it's count. |
|
| 48 | - * |
|
| 49 | - * @return mixed |
|
| 50 | - */ |
|
| 51 | - public function networkDistribution() |
|
| 52 | - { |
|
| 53 | - $this->createSqliteRegexpFunction(); |
|
| 46 | + /** |
|
| 47 | + * Returns a collection of all networks and it's count. |
|
| 48 | + * |
|
| 49 | + * @return mixed |
|
| 50 | + */ |
|
| 51 | + public function networkDistribution() |
|
| 52 | + { |
|
| 53 | + $this->createSqliteRegexpFunction(); |
|
| 54 | 54 | |
| 55 | - $data = Poke::select( |
|
| 56 | - DB::raw(" |
|
| 55 | + $data = Poke::select( |
|
| 56 | + DB::raw(" |
|
| 57 | 57 | CASE |
| 58 | 58 | WHEN ip LIKE '192.168.%' |
| 59 | 59 | THEN '192.168.0.0/16' |
@@ -64,31 +64,31 @@ discard block |
||
| 64 | 64 | ELSE 'Internet' |
| 65 | 65 | END |
| 66 | 66 | AS label, count(*) as value") |
| 67 | - ) |
|
| 68 | - ->groupBy('label') |
|
| 69 | - ->orderBy('label') |
|
| 70 | - ->get(); |
|
| 67 | + ) |
|
| 68 | + ->groupBy('label') |
|
| 69 | + ->orderBy('label') |
|
| 70 | + ->get(); |
|
| 71 | 71 | |
| 72 | - return $this->addColors($data); |
|
| 73 | - } |
|
| 72 | + return $this->addColors($data); |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * Creates the Regexp function for the SQLITE database. |
|
| 77 | - */ |
|
| 78 | - protected function createSqliteRegexpFunction() |
|
| 79 | - { |
|
| 80 | - DB::connection()->getPdo()->sqliteCreateFunction('REGEXP', 'preg_match', 2); |
|
| 81 | - } |
|
| 75 | + /** |
|
| 76 | + * Creates the Regexp function for the SQLITE database. |
|
| 77 | + */ |
|
| 78 | + protected function createSqliteRegexpFunction() |
|
| 79 | + { |
|
| 80 | + DB::connection()->getPdo()->sqliteCreateFunction('REGEXP', 'preg_match', 2); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - private function addColors($data) |
|
| 84 | - { |
|
| 85 | - $colors = ['rgb(23,103,153)', 'rgb(47,135,176)', 'rgb(66,164,187)', 'rgb(91,192,196)']; |
|
| 86 | - $highlight_colors = ['#8BB3CC', '#97C3D7', '#ADDFE1', '#BBEAE3']; |
|
| 87 | - foreach ($data as $i => $network) { |
|
| 88 | - $network['color'] = $colors[$i]; |
|
| 89 | - $network['highlight'] = $highlight_colors[$i]; |
|
| 90 | - } |
|
| 83 | + private function addColors($data) |
|
| 84 | + { |
|
| 85 | + $colors = ['rgb(23,103,153)', 'rgb(47,135,176)', 'rgb(66,164,187)', 'rgb(91,192,196)']; |
|
| 86 | + $highlight_colors = ['#8BB3CC', '#97C3D7', '#ADDFE1', '#BBEAE3']; |
|
| 87 | + foreach ($data as $i => $network) { |
|
| 88 | + $network['color'] = $colors[$i]; |
|
| 89 | + $network['highlight'] = $highlight_colors[$i]; |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - return $data; |
|
| 93 | - } |
|
| 92 | + return $data; |
|
| 93 | + } |
|
| 94 | 94 | } |
@@ -4,16 +4,16 @@ |
||
| 4 | 4 | |
| 5 | 5 | class DeviceTransformer extends Transformer |
| 6 | 6 | { |
| 7 | - public function transform($device) |
|
| 8 | - { |
|
| 9 | - return [ |
|
| 10 | - 'ip' => $device['ip'], |
|
| 11 | - 'mac' => $device['mac'], |
|
| 12 | - 'name' => $device['name'], |
|
| 13 | - 'group' => $device['group'], |
|
| 14 | - 'on_home_page' => $device['public'], |
|
| 15 | - 'device_added' => $device['created_at']->toIso8601String(), |
|
| 16 | - 'last_contact' => $device['updated_at']->toIso8601String(), |
|
| 17 | - ]; |
|
| 18 | - } |
|
| 7 | + public function transform($device) |
|
| 8 | + { |
|
| 9 | + return [ |
|
| 10 | + 'ip' => $device['ip'], |
|
| 11 | + 'mac' => $device['mac'], |
|
| 12 | + 'name' => $device['name'], |
|
| 13 | + 'group' => $device['group'], |
|
| 14 | + 'on_home_page' => $device['public'], |
|
| 15 | + 'device_added' => $device['created_at']->toIso8601String(), |
|
| 16 | + 'last_contact' => $device['updated_at']->toIso8601String(), |
|
| 17 | + ]; |
|
| 18 | + } |
|
| 19 | 19 | } |
@@ -4,17 +4,17 @@ |
||
| 4 | 4 | |
| 5 | 5 | abstract class Transformer |
| 6 | 6 | { |
| 7 | - /** |
|
| 8 | - * Transform a collection of items. |
|
| 9 | - * |
|
| 10 | - * @param array $items |
|
| 11 | - * |
|
| 12 | - * @return array |
|
| 13 | - */ |
|
| 14 | - public function transformCollection(array $items) |
|
| 15 | - { |
|
| 16 | - return array_map([$this, 'transform'], $items); |
|
| 17 | - } |
|
| 7 | + /** |
|
| 8 | + * Transform a collection of items. |
|
| 9 | + * |
|
| 10 | + * @param array $items |
|
| 11 | + * |
|
| 12 | + * @return array |
|
| 13 | + */ |
|
| 14 | + public function transformCollection(array $items) |
|
| 15 | + { |
|
| 16 | + return array_map([$this, 'transform'], $items); |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - abstract public function transform($item); |
|
| 19 | + abstract public function transform($item); |
|
| 20 | 20 | } |
@@ -10,26 +10,26 @@ |
||
| 10 | 10 | |
| 11 | 11 | class User extends Model implements AuthenticatableContract, CanResetPasswordContract |
| 12 | 12 | { |
| 13 | - use Authenticatable, CanResetPassword; |
|
| 13 | + use Authenticatable, CanResetPassword; |
|
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * The database table used by the model. |
|
| 17 | - * |
|
| 18 | - * @var string |
|
| 19 | - */ |
|
| 20 | - protected $table = 'users'; |
|
| 15 | + /** |
|
| 16 | + * The database table used by the model. |
|
| 17 | + * |
|
| 18 | + * @var string |
|
| 19 | + */ |
|
| 20 | + protected $table = 'users'; |
|
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * The attributes that are mass assignable. |
|
| 24 | - * |
|
| 25 | - * @var array |
|
| 26 | - */ |
|
| 27 | - protected $fillable = ['email', 'password']; |
|
| 22 | + /** |
|
| 23 | + * The attributes that are mass assignable. |
|
| 24 | + * |
|
| 25 | + * @var array |
|
| 26 | + */ |
|
| 27 | + protected $fillable = ['email', 'password']; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * The attributes excluded from the model's JSON form. |
|
| 31 | - * |
|
| 32 | - * @var array |
|
| 33 | - */ |
|
| 34 | - protected $hidden = ['password', 'remember_token']; |
|
| 29 | + /** |
|
| 30 | + * The attributes excluded from the model's JSON form. |
|
| 31 | + * |
|
| 32 | + * @var array |
|
| 33 | + */ |
|
| 34 | + protected $hidden = ['password', 'remember_token']; |
|
| 35 | 35 | } |
@@ -4,5 +4,5 @@ |
||
| 4 | 4 | |
| 5 | 5 | abstract class Event |
| 6 | 6 | { |
| 7 | - // |
|
| 7 | + // |
|
| 8 | 8 | } |