1
0
mirror of https://github.com/ToxicCrack/PrintABrick.git synced 2025-05-21 06:30:10 -07:00

Fix coding style with php-cs-fixer

This commit is contained in:
David Hübner 2017-01-17 12:18:45 +01:00
parent 3ede847697
commit 39f69d2110
27 changed files with 108 additions and 135 deletions

View File

@ -23,7 +23,7 @@ class Brickset extends \SoapClient
/**
* @var array The defined classes
*/
private static $classmap = array(
private static $classmap = [
'sets' => Set::class,
'additionalImages' => AdditionalImage::class,
'instructions' => Instructions::class,
@ -31,14 +31,14 @@ class Brickset extends \SoapClient
'themes' => Theme::class,
'subthemes' => Subtheme::class,
'years' => Year::class,
);
];
/**
* @param string $apikey Brickset API key
* @param array $options A array of config values
* @param string $wsdl The wsdl file to use
*/
public function __construct($apikey, $wsdl = null, array $options = array())
public function __construct($apikey, $wsdl = null, array $options = [])
{
$this->apiKey = $apikey;
@ -238,12 +238,11 @@ class Brickset extends \SoapClient
return false;
} elseif (strpos($response, 'ERROR:') === 0) {
return false;
} else {
}
$this->userHash = $response;
return true;
}
}
/**
* Check if an API key is valid.

View File

@ -57,7 +57,7 @@ class Review
/**
* Review constructor.
*/
function __construct()
public function __construct()
{
}
@ -88,14 +88,13 @@ class Review
{
if ($this->datePosted == null) {
return null;
} else {
}
try {
return new \DateTime($this->datePosted);
} catch (\Exception $e) {
return null;
}
}
}
/**
* @param \DateTime $datePosted

View File

@ -848,14 +848,13 @@ class Set
{
if ($this->lastUpdated == null) {
return null;
} else {
}
try {
return new \DateTime($this->lastUpdated);
} catch (\Exception $e) {
return null;
}
}
}
/**
* @param \DateTime $lastUpdated

View File

@ -138,6 +138,7 @@ class Part
{
$this->name = $name;
}
/**
* @return mixed
*/
@ -185,6 +186,7 @@ class Part
{
$this->category = $category;
}
/**
* @return mixed
*/
@ -200,6 +202,7 @@ class Part
{
$this->colors = $colors;
}
/**
* @return mixed
*/

View File

@ -52,13 +52,12 @@ class Rebrickable
throw new LogicException('Invalid API Key');
} elseif ($content === 'NOSET' || $content === 'NOPART') {
return null;
} else {
}
return $content;
}
} else {
//TODO
throw new LogicException($response->getStatusCode());
}
} catch (ConnectException $e) {
//TODO
throw new LogicException($e->getMessage());

View File

@ -2,11 +2,11 @@
namespace AppBundle\Api\Manager;
use AppBundle\Api\Client\Rebrickable\Rebrickable;
use AppBundle\Api\Client\Rebrickable\Converter\PartPropertyNameConverter;
use AppBundle\Api\Client\Rebrickable\Entity\Color;
use AppBundle\Api\Client\Rebrickable\Entity\Part;
use AppBundle\Api\Client\Rebrickable\Entity\Set;
use AppBundle\Api\Client\Rebrickable\Converter\PartPropertyNameConverter;
use AppBundle\Api\Client\Rebrickable\Rebrickable;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
@ -33,10 +33,10 @@ class RebrickableManager
private function getSerializer()
{
$encoders = array(new JsonEncoder());
$encoders = [new JsonEncoder()];
$nameConverter = new PartPropertyNameConverter();
$objectNormalizer = new ObjectNormalizer(null, $nameConverter);
$normalizers = array($objectNormalizer, new ArrayDenormalizer());
$normalizers = [$objectNormalizer, new ArrayDenormalizer()];
$serializer = new Serializer($normalizers, $encoders);
return $serializer;

View File

@ -6,7 +6,6 @@ use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Finder\Finder;
class LoadLDrawCommand extends ContainerAwareCommand
{
@ -15,9 +14,8 @@ class LoadLDrawCommand extends ContainerAwareCommand
$this
->setName('app:load:ldraw')
->setDescription('Loads LDraw library parts')
->setHelp("This command allows you to..")
->addArgument('ldraw', InputArgument::REQUIRED, 'Path to LDraw library folder')
;
->setHelp('This command allows you to..')
->addArgument('ldraw', InputArgument::REQUIRED, 'Path to LDraw library folder');
}
protected function execute(InputInterface $input, OutputInterface $output)

View File

@ -13,8 +13,7 @@ class LoadRebrickableCommand extends ContainerAwareCommand
$this
->setName('app:load:rebrickable')
->setDescription('Loads Rebrickable csv data')
->setHelp('This command allows you to..')
;
->setHelp('This command allows you to..');
}
protected function execute(InputInterface $input, OutputInterface $output)

View File

@ -2,8 +2,8 @@
namespace AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
/**
* @Route("rebrickable/parts")

View File

@ -43,7 +43,7 @@ class SetsController extends Controller
*/
public function detailAction(Request $request, $id, $name = null)
{
$set = $this->get('manager.brickset')->getSetById($id);;
$set = $this->get('manager.brickset')->getSetById($id);
$parts = $this->get('sevice.collection')->getSet($set->getNumber().'-'.$set->getNumberVariant())->getParts();

View File

@ -7,7 +7,7 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* BuildingKit
* BuildingKit.
*
* @ORM\Table(name="building_kit")
* @ORM\Entity(repositoryClass="AppBundle\Repository\BuildingKitRepository")
@ -74,9 +74,8 @@ class BuildingKit
$this->keywords = new ArrayCollection();
}
/**
* Get id
* Get id.
*
* @return int
*/
@ -105,9 +104,8 @@ class BuildingKit
return $this;
}
/**
* Set name
* Set name.
*
* @param string $name
*
@ -121,7 +119,7 @@ class BuildingKit
}
/**
* Get name
* Get name.
*
* @return string
*/
@ -131,9 +129,9 @@ class BuildingKit
}
/**
* Set year
* Set year.
*
* @param integer $year
* @param int $year
*
* @return BuildingKit
*/
@ -145,7 +143,7 @@ class BuildingKit
}
/**
* Get year
* Get year.
*
* @return int
*/
@ -175,7 +173,7 @@ class BuildingKit
}
/**
* Get parts
* Get parts.
*
* @return Collection
*/
@ -209,7 +207,7 @@ class BuildingKit
}
/**
* Get keywords
* Get keywords.
*
* @return Collection
*/

View File

@ -5,10 +5,9 @@ namespace AppBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Form\CallbackTransformer;
/**
* Category
* Category.
*
* @ORM\Table(name="category")
* @ORM\Entity(repositoryClass="AppBundle\Repository\CategoryRepository")
@ -54,9 +53,8 @@ class Category
$this->parts = new ArrayCollection();
}
/**
* Get id
* Get id.
*
* @return int
*/
@ -66,7 +64,7 @@ class Category
}
/**
* Set name
* Set name.
*
* @param string $name
*
@ -80,7 +78,7 @@ class Category
}
/**
* Get name
* Get name.
*
* @return string
*/
@ -90,7 +88,7 @@ class Category
}
/**
* Get models
* Get models.
*
* @return ArrayCollection
*/
@ -124,7 +122,7 @@ class Category
}
/**
* Get parts
* Get parts.
*
* @return ArrayCollection
*/

View File

@ -6,7 +6,7 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* Color
* Color.
*
* @ORM\Table(name="color")
* @ORM\Entity(repositoryClass="AppBundle\Repository\ColorRepository")
@ -43,7 +43,7 @@ class Color
private $part_building_kits;
/**
* Set id
* Set id.
*
* @var int
*
@ -57,7 +57,7 @@ class Color
}
/**
* Get id
* Get id.
*
* @return int
*/
@ -67,7 +67,7 @@ class Color
}
/**
* Set name
* Set name.
*
* @param string $name
*
@ -81,7 +81,7 @@ class Color
}
/**
* Get name
* Get name.
*
* @return string
*/
@ -91,7 +91,7 @@ class Color
}
/**
* Set rgb
* Set rgb.
*
* @param string $rgb
*
@ -105,7 +105,7 @@ class Color
}
/**
* Get rgb
* Get rgb.
*
* @return string
*/
@ -123,7 +123,6 @@ class Color
}
/**
*
* @param Part_BuildingKit $part_building_kit
*
* @return Color
@ -148,11 +147,10 @@ class Color
}
/**
* Constructor
* Constructor.
*/
public function __construct()
{
$this->part_building_kits = new \Doctrine\Common\Collections\ArrayCollection();
}
}

View File

@ -6,7 +6,7 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
* Keyword
* Keyword.
*
* @ORM\Table(name="keyword")
* @ORM\Entity(repositoryClass="AppBundle\Repository\KeywordRepository")
@ -44,9 +44,8 @@ class Keyword
$this->building_kits = new ArrayCollection();
}
/**
* Get id
* Get id.
*
* @return int
*/
@ -56,7 +55,7 @@ class Keyword
}
/**
* Set name
* Set name.
*
* @param string $name
*
@ -70,7 +69,7 @@ class Keyword
}
/**
* Get name
* Get name.
*
* @return string
*/
@ -110,5 +109,4 @@ class Keyword
return $this;
}
}

View File

@ -6,7 +6,7 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* Model
* Model.
*
* @ORM\Table(name="model")
* @ORM\Entity(repositoryClass="AppBundle\Repository\ModelRepository")
@ -57,9 +57,8 @@ class Model
*/
private $category;
/**
* Get id
* Get id.
*
* @return int
*/
@ -69,7 +68,7 @@ class Model
}
/**
* Set number
* Set number.
*
* @param string $number
*
@ -83,7 +82,7 @@ class Model
}
/**
* Get number
* Get number.
*
* @return string
*/
@ -93,7 +92,7 @@ class Model
}
/**
* Set author
* Set author.
*
* @param string $author
*
@ -107,7 +106,7 @@ class Model
}
/**
* Get author
* Get author.
*
* @return string
*/
@ -117,7 +116,7 @@ class Model
}
/**
* Set file
* Set file.
*
* @param string $file
*
@ -131,7 +130,7 @@ class Model
}
/**
* Get file
* Get file.
*
* @return string
*/
@ -141,7 +140,7 @@ class Model
}
/**
* Get parts
* Get parts.
*
* @return Collection
*/
@ -175,7 +174,7 @@ class Model
}
/**
* Set category
* Set category.
*
* @param Category $category
*
@ -190,7 +189,7 @@ class Model
}
/**
* Get category
* Get category.
*
* @return Category
*/

View File

@ -2,11 +2,10 @@
namespace AppBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
* Part_BuildingKit
* Part_BuildingKit.
*
* @ORM\Table(name="part__building_kit")
* @ORM\Entity(repositoryClass="AppBundle\Repository\Part_BuildingKitRepository")
@ -57,9 +56,8 @@ class Part_BuildingKit
*/
private $building_kit;
/**
* Get id
* Get id.
*
* @return int
*/
@ -69,9 +67,9 @@ class Part_BuildingKit
}
/**
* Set count
* Set count.
*
* @param integer $count
* @param int $count
*
* @return Part_BuildingKit
*/
@ -83,7 +81,7 @@ class Part_BuildingKit
}
/**
* Get count
* Get count.
*
* @return int
*/
@ -93,7 +91,7 @@ class Part_BuildingKit
}
/**
* Set color
* Set color.
*
* @param Color $color
*
@ -107,7 +105,7 @@ class Part_BuildingKit
}
/**
* Get color
* Get color.
*
* @return Color
*/
@ -117,9 +115,9 @@ class Part_BuildingKit
}
/**
* Set type
* Set type.
*
* @param boolean $type
* @param bool $type
*
* @return Part_BuildingKit
*/
@ -131,7 +129,7 @@ class Part_BuildingKit
}
/**
* Get type
* Get type.
*
* @return bool
*/
@ -181,6 +179,4 @@ class Part_BuildingKit
return $this;
}
}

View File

@ -26,36 +26,35 @@ class FilterSetType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add("theme", ChoiceType::class, [
->add('theme', ChoiceType::class, [
'choices' => $this->bricksetManager->getThemes(),
'choice_label' => function (Theme $theme = null) {
return $theme ? $theme->getTheme().' ('.$theme->getSetCount().')' : '';
},
'placeholder' => '',
'required' => false
'required' => false,
]);
$formModifier = function (Form $form, Theme $theme = null) {
$subthemes = null === $theme ? [] : $this->bricksetManager->getSubthemesByTheme($theme);
$years = null === $theme ? [] : $this->bricksetManager->getYearsByTheme($theme);
$form->add("subtheme", ChoiceType::class, [
$form->add('subtheme', ChoiceType::class, [
'choices' => $subthemes,
'choice_label' => function (Subtheme $subtheme = null) {
return $subtheme ? $subtheme->getSubtheme() : '';
},
'placeholder' => '',
'required' => false
'required' => false,
]);
$form->add("years", ChoiceType::class, [
$form->add('years', ChoiceType::class, [
'choices' => $years,
'choice_label' => function (Year $year = null) {
return $year ? $year->getYear() : '';
},
'placeholder' => '',
'required' => false
'required' => false,
]);
};

View File

@ -3,13 +3,8 @@
namespace AppBundle\Loader;
use AppBundle\Entity\Model;
use Doctrine\ORM\EntityManager;
use League\Flysystem\Adapter\Local;
use League\Flysystem\Adapter\NullAdapter;
use League\Flysystem\FileExistsException;
use League\Flysystem\FileNotFoundException;
use League\Flysystem\Filesystem;
use Oneup\FlysystemBundle\OneupFlysystemBundle;
use Symfony\Component\Asset\Exception\LogicException;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Finder\Finder;
@ -25,7 +20,7 @@ class LDrawLoader extends Loader
private $ldview;
/**
* @var $ldraw Filesystem
* @var Filesystem
*/
private $ldraw;

View File

@ -2,9 +2,7 @@
namespace AppBundle\Loader;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Output\OutputInterface;
class Loader
@ -16,7 +14,8 @@ class Loader
protected $output;
public function setOutput(OutputInterface $output) {
public function setOutput(OutputInterface $output)
{
$this->output = $output;
$this->output->setDecorated(true);
}

View File

@ -3,10 +3,10 @@
namespace AppBundle\Loader;
use AppBundle\Api\Manager\RebrickableManager;
use AppBundle\Entity\BuildingKit;
use AppBundle\Entity\Category;
use AppBundle\Entity\Color;
use AppBundle\Entity\Keyword;
use AppBundle\Entity\BuildingKit;
use AppBundle\Entity\Part;
use AppBundle\Entity\Part_BuildingKit;
use Doctrine\ORM\EntityManager;
@ -24,7 +24,7 @@ class RebrickableLoader extends Loader
*/
public function __construct($em, $rebrickableManager)
{
/**
/*
* @var $em EntityManager
* */
$this->em = $em;
@ -159,7 +159,6 @@ class RebrickableLoader extends Loader
$this->em->getConnection()->getConfiguration()->setSQLLogger(null);
if (($handle = fopen($pieces, 'r')) !== false) {
// create a new progress bar (50 units)
$progress = new ProgressBar($this->output, intval(exec("wc -l '$pieces'")));
$progress->setFormat('very_verbose');

View File

@ -5,7 +5,7 @@ namespace AppBundle\Repository;
use AppBundle\Entity\Part;
/**
* BuildingSetRepository
* BuildingSetRepository.
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.

View File

@ -2,10 +2,8 @@
namespace AppBundle\Repository;
use AppBundle\Entity\Category;
/**
* CategoryRepository
* CategoryRepository.
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.

View File

@ -3,7 +3,7 @@
namespace AppBundle\Repository;
/**
* ColorRepository
* ColorRepository.
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.

View File

@ -3,7 +3,7 @@
namespace AppBundle\Repository;
/**
* KeywordRepository
* KeywordRepository.
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.

View File

@ -3,7 +3,7 @@
namespace AppBundle\Repository;
/**
* ModelRepository
* ModelRepository.
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.

View File

@ -3,7 +3,7 @@
namespace AppBundle\Repository;
/**
* PartRepository
* PartRepository.
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.

View File

@ -3,7 +3,7 @@
namespace AppBundle\Repository;
/**
* Part_BuildingKitRepository
* Part_BuildingKitRepository.
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.