Skip to content

Commit

Permalink
Merge pull request #1 from crypta-tech/analysis-ZnyZ7N
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
Crypta-Eve authored Jan 21, 2024
2 parents 257b85b + 766eda4 commit db3464f
Show file tree
Hide file tree
Showing 17 changed files with 168 additions and 183 deletions.
12 changes: 6 additions & 6 deletions src/Config/Permissions/fitting.permissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,33 @@
/**
* User: Warlof Tutsimo <[email protected]>
* Date: 15/06/2016
* Time: 22:02
* Time: 22:02.
*/

return [
'view' => [
'label' => 'View Fittings',
'description' => 'Ability to see the fittings page',
'division' => 'military'
'division' => 'military',
],
'create' => [
'label' => 'Create Fittings',
'description' => 'Ability to submit new fittings/doctrines',
'division' => 'military'
'division' => 'military',
],
'doctrineview' => [
'label' => 'View Doctrines',
'description' => 'Ability to see the doctrines page',
'division' => 'military'
'division' => 'military',
],
'reportview' => [
'label' => 'View Reports',
'description' => 'View Reports',
'division' => 'military'
'division' => 'military',
],
'settings' => [
'label' => 'Settings',
'description' => 'Settings',
'division' => 'military'
'division' => 'military',
],
];
2 changes: 1 addition & 1 deletion src/Config/fitting.config.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* User: Denngarr B'tarn <[email protected]>
* Date: 2017/11/03
* Date: 2017/11/03.
*/

return [
Expand Down
18 changes: 9 additions & 9 deletions src/Config/fitting.exportlinks.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
<?php

return [
// 'example'=>[
// "route"=>"cryptafitting::about",//receives the id as argument
// "name"=>"open in seat-alliance-industry"
// ],
// 'example2'=>[
// "url"=>"https://example.com",//receives the id as argument
// "name"=>"open in seat-inventory"
// ]
// 'example'=>[
// "route"=>"cryptafitting::about",//receives the id as argument
// "name"=>"open in seat-alliance-industry"
// ],
// 'example2'=>[
// "url"=>"https://example.com",//receives the id as argument
// "name"=>"open in seat-inventory"
// ]
];
18 changes: 9 additions & 9 deletions src/Config/fitting.sidebar.php
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
<?php
<?php

return [
'doctrine' => [
'name' => 'Doctrines & Fittings',
'permission' => 'fitting.doctrineview',
'route_segment' => 'fitting',
'icon' => 'fas fa-rocket',
'entries' => [
'entries' => [
'fitting' => [
'name' => 'Fittings',
'icon' => 'fas fa-rocket',
'route_segment' => 'fitting',
'route' => 'cryptafitting::view',
'permission' => 'fitting.view'
'permission' => 'fitting.view',
],
'doctrine' => [
'name' => 'Doctrine',
'icon' => 'fas fa-list',
'route_segment' => 'fitting',
'route' => 'cryptafitting::doctrineview',
'permission' => 'fitting.doctrineview'
'permission' => 'fitting.doctrineview',
],
'doctrinereport' => [
'name' => 'Doctrine Report',
'icon' => 'fas fa-chart-pie',
'route_segment' => 'fitting',
'route' => 'cryptafitting::doctrinereport',
'permission' => 'fitting.reportview'
'permission' => 'fitting.reportview',
],
'about' => [
'name' => 'About',
'icon' => 'fas fa-info',
'route_segment' => 'fitting',
'route' => 'cryptafitting::about',
'permission' => 'fitting.view'
'permission' => 'fitting.view',
],
'settings' => [
'name' => 'Settings',
'icon' => 'fas fa-cog',
'route_segment' => 'fitting',
'route' => 'fitting.settings',
'permission' => 'fitting.settings'
'permission' => 'fitting.settings',
],
]
]
],
],
];
3 changes: 1 addition & 2 deletions src/FittingServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function boot()
$this->add_translations();

$this->publishes([
__DIR__.'/Config/fitting.exportlinks.php' => config_path('fitting.exportlinks.php')],["config","seat"]
__DIR__ . '/Config/fitting.exportlinks.php' => config_path('fitting.exportlinks.php')], ['config', 'seat']
);

$this->addMigrations();
Expand Down Expand Up @@ -87,7 +87,6 @@ public function getName(): string
return 'Fitting';
}


/**
* Return the plugin repository address.
*
Expand Down
53 changes: 26 additions & 27 deletions src/Helpers/CalculateConstants.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?PHP
<?php

namespace CryptaTech\Seat\Fitting\Helpers;

Expand All @@ -11,7 +11,7 @@ interface CalculateConstants
182, 183, 184, 1285, 1289, 1290,
];

const REQ_SKILLS_LEVELS = [
const REQ_SKILLS_LEVELS = [
277, 278, 279, 1286, 1287, 1288,
];

Expand All @@ -24,14 +24,14 @@ interface CalculateConstants
1290 => 1288,
];

const DG_PGOUTPUT = 11;
const DG_PGLOAD = 15;
const DG_PGOUTPUT = 11;
const DG_PGLOAD = 15;
const DG_CPUOUTPUT = 48;
const DG_CPULOAD = 49;
const DG_CPULOAD = 49;

const RAISE_ALREADY_FULLFILLED = 0;
const RAISE_SKILL_RAISED = 1;
const RAISE_CANNOT_RAISE = 2;
const RAISE_SKILL_RAISED = 1;
const RAISE_CANNOT_RAISE = 2;

const CPU_SKILL_ORDER = [
// CPU Management
Expand All @@ -48,25 +48,24 @@ interface CalculateConstants
[3318 => 5],
];
const PG_SKILL_ORDER = [
// Power Grid Management
// Shield Upgrades
// Advanced Weapon Upgrades
[3413 => 1],
[3413 => 2],
[3413 => 3],
[3413 => 4],
[3413 => 5],
[3425 => 1],
[11207 => 1],
[3425 => 2],
[11207 => 2],
[3425 => 3],
[11207 => 3],
[3425 => 4],
[11207 => 4],
[3425 => 5],
[11207 => 5],
];
// Power Grid Management
// Shield Upgrades
// Advanced Weapon Upgrades
[3413 => 1],
[3413 => 2],
[3413 => 3],
[3413 => 4],
[3413 => 5],
[3425 => 1],
[11207 => 1],
[3425 => 2],
[11207 => 2],
[3425 => 3],
[11207 => 3],
[3425 => 4],
[11207 => 4],
[3425 => 5],
[11207 => 5],
];

}

27 changes: 13 additions & 14 deletions src/Helpers/CalculateEft.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?PHP
<?php

namespace CryptaTech\Seat\Fitting\Helpers;

use Seat\Eveapi\Models\Sde\InvType;
use Seat\Eveapi\Models\Sde\DgmTypeAttribute;
use Seat\Eveapi\Models\Sde\InvType;

trait CalculateEft
trait CalculateEft
{
private $ctx;

Expand All @@ -27,7 +27,7 @@ public function calculate($fitting)
private function modifyRequiredSkills($fitting)
{
// skip this, if dogma extension isn't loaded
if (!extension_loaded('dogma')) {
if (! extension_loaded('dogma')) {
return;
}

Expand Down Expand Up @@ -73,16 +73,16 @@ private function raiseSkill($type)
{
switch ($type) {
case 'cpu':
$index =& $this->cpu_raise_index;
$index = &$this->cpu_raise_index;
$skillsOrder = self::CPU_SKILL_ORDER;
break;
case 'powergrid':
$index =& $this->pg_raise_index;
$index = &$this->pg_raise_index;
$skillsOrder = self::PG_SKILL_ORDER;
break;
}

if (!isset($skillsOrder[$index])) {
if (! isset($skillsOrder[$index])) {
return self::RAISE_CANNOT_RAISE;
}

Expand Down Expand Up @@ -166,7 +166,7 @@ private function parseEftFitting($fitting)
$fitsplit = explode("\n", $fitting);

// get shipname of first line by removing brackets
list($shipname, $fitname) = explode(", ", substr(array_shift($fitsplit), 1, -1));
[$shipname, $fitname] = explode(', ', substr(array_shift($fitsplit), 1, -1));

$fit_all_items = [];
$fit_calc_items = [];
Expand All @@ -176,7 +176,7 @@ private function parseEftFitting($fitting)

foreach ($fitsplit as $key => $line) {
// split line to get charge
$linesplit = explode(",", $line);
$linesplit = explode(',', $line);

if (isset($linesplit[1])) {
$fit_all_items[] = $linesplit[1];
Expand Down Expand Up @@ -213,16 +213,15 @@ private function convertToTypeIDs($items)
private function sanatizeFittingBlock($fitting)
{
// remove useless empty lines and whatnot
$fitting = preg_replace("/\[Empty .+ slot\]/", "", $fitting);
$fitting = preg_replace("/\[Empty .+ slot\]/", '', $fitting);

return ltrim(rtrim(preg_replace("/^[ \t]*[\r\n]+/m", "", $fitting)));
return ltrim(rtrim(preg_replace("/^[ \t]*[\r\n]+/m", '', $fitting)));
}

private function sanatizeTypeName($item)
{
// remove amount for charges
// sample: Scourge Rage Heavy Assault Missile x66
return ltrim(rtrim(preg_replace("/ x\d+/", "", $item)));
return ltrim(rtrim(preg_replace("/ x\d+/", '', $item)));
}

};
}
10 changes: 4 additions & 6 deletions src/Http/Controllers/ApiFittingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,31 @@
namespace CryptaTech\Seat\Fitting\Http\Controllers;

use Seat\Api\Http\Controllers\Api\v2\ApiController;
use CryptaTech\Seat\Fitting\Http\Controllers\FittingController;

/**
* Class ApiFittingController.
*
* @package CryptaTech\Seat\Fitting\Http\Controllers
*/
class ApiFittingController extends ApiController
{

public function getFittingList()
{
return FittingController::getFittingList();
}

public function getFittingById($id)
{
return FittingController::getFittingById($id);
}

public function getDoctrineList()
{
return FittingController::getDoctrineList();
}

public function getDoctrineList($id)
{
return FittingController::getDoctrineById($id);
}

}
Loading

0 comments on commit db3464f

Please sign in to comment.