Skip to content

Commit

Permalink
Apply style ci
Browse files Browse the repository at this point in the history
  • Loading branch information
made committed Apr 7, 2017
1 parent 6b920b9 commit 63cae0f
Show file tree
Hide file tree
Showing 44 changed files with 472 additions and 326 deletions.
41 changes: 18 additions & 23 deletions Command/BlogImportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,11 @@
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\Serializer\Encoder\XmlEncoder;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
use Symfony\Component\Serializer\Serializer;
use Victoire\DevTools\VacuumBundle\Pipeline\WordPress\IOWordPressPipeline;
use Symfony\Component\Console\Question\Question;
use Symfony\Component\HttpFoundation\File\File;

/**
* Class BlogImportCommand
* @package Victoire\VacuumBundle\Command
* Class BlogImportCommand.
*/
class BlogImportCommand extends ContainerAwareCommand
{
Expand All @@ -36,7 +30,7 @@ public function configure()
new InputOption('article_template_layout', '-atl', InputOption::VALUE_OPTIONAL, 'article template layout designation'),
new InputOption('article_template_parent_id', '-atpid', InputOption::VALUE_OPTIONAL, 'article template parent id'),
new InputOption('article_template_id', '-ati', InputOption::VALUE_OPTIONAL, 'Id of an existing article template'),
new InputOption('article_template_first_slot', '-atfs', InputOption::VALUE_OPTIONAL, 'slot designation for root widget map in article template')
new InputOption('article_template_first_slot', '-atfs', InputOption::VALUE_OPTIONAL, 'slot designation for root widget map in article template'),
])
->setDescription('Import blog form dump')
->setHelp(<<<'EOT'
Expand All @@ -61,15 +55,15 @@ public function configure()
}

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$questionHelper = $this->getQuestionHelper();
$commandParameters = [];

$requiredParameter = ["blog_name", "dump", "article_template_first_slot"];
$requiredParameter = ['blog_name', 'dump', 'article_template_first_slot'];

foreach ($requiredParameter as $parameter) {
if (null == $input->getOption($parameter)) {
Expand Down Expand Up @@ -103,9 +97,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
}

if ($input->isInteractive()) {
$message = "";
$message = '';
foreach ($commandParameters as $key => $parameter) {
$message .= "<info>".$key.":</info> ".$parameter."\n";
$message .= '<info>'.$key.':</info> '.$parameter."\n";
}

//summary
Expand All @@ -122,13 +116,13 @@ protected function execute(InputInterface $input, OutputInterface $output)

$question = new ConfirmationQuestion(
$questionHelper->getQuestion(
'do you wish to continue ?'
, 'yes', '?'),
'do you wish to continue ?', 'yes', '?'),
true
);

if (!$questionHelper->ask($input, $output, $question)) {
$output->writeln('<error>Command aborted</error>');

return 1;
}
}
Expand All @@ -138,7 +132,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
*/
protected function interact(InputInterface $input, OutputInterface $output)
Expand All @@ -155,7 +149,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
// blog name
$question = new Question($questionHelper->getQuestion('blog name', $input->getOption('blog_name')));
$question->setValidator(function ($answer) {
return self::validateBlogName($answer);
return self::validateBlogName($answer);
});

$blogName = (string) $questionHelper->ask($input, $output, $question);
Expand All @@ -164,7 +158,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
// blog template id
$question = new Question($questionHelper->getQuestion('blog template id', $input->getOption('blog_template')));
$question->setValidator(function ($answer) {
return self::validateTemplateId($answer);
return self::validateTemplateId($answer);
});

$blogTemplateId = (int) $questionHelper->ask($input, $output, $question);
Expand All @@ -182,7 +176,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
// path to dump
$question = new Question($questionHelper->getQuestion('path to dump', $input->getOption('dump')));
$question->setValidator(function ($answer) {
return self::validatePath($answer);
return self::validatePath($answer);
});

$pathToDump = (string) $questionHelper->ask($input, $output, $question);
Expand All @@ -209,7 +203,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
// ArticleTemplate parent_id
$question = new Question($questionHelper->getQuestion('Article template parent id', $input->getOption('article_template_parent_id')));
$question->setValidator(function ($answer) {
return self::validateTemplateId($answer);
return self::validateTemplateId($answer);
});

$articleTemplateParentId = (int) $questionHelper->ask($input, $output, $question);
Expand All @@ -219,7 +213,6 @@ protected function interact(InputInterface $input, OutputInterface $output)
$question = new Question($questionHelper->getQuestion('Article Template first slot', $input->getOption('article_template_first_slot')));
$articleTemplateFirstSlot = (string) $questionHelper->ask($input, $output, $question);
$input->setOption('article_template_first_slot', $articleTemplateFirstSlot);

} else {

// ArticleTemplate Id
Expand All @@ -240,6 +233,7 @@ protected function interact(InputInterface $input, OutputInterface $output)

/**
* @param $id int
*
* @return int
*/
private function validateView($id)
Expand Down Expand Up @@ -278,7 +272,7 @@ private function validatePath($path)
throw new RuntimeException(sprintf('Wrong path the file "%s" can\'t be found', $path));
}

if (mime_content_type($path) != "application/xml") {
if (mime_content_type($path) != 'application/xml') {
throw new RuntimeException('Wrong file format. Format accepted "xml"');
}

Expand Down Expand Up @@ -309,6 +303,7 @@ private function validateArticleTemplateId($id)

/**
* @param $name
*
* @return ConfirmationQuestion
*/
private function validateLayout($name)
Expand Down Expand Up @@ -347,4 +342,4 @@ protected function getQuestionHelper()

return $questionHelper;
}
}
}
4 changes: 2 additions & 2 deletions DependencyInjection/VictoireVacuumExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Victoire\DevTools\VacuumBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
* This is the class that loads and manages your bundle configuration.
Expand Down
11 changes: 8 additions & 3 deletions Entity/AbstractVacuumRelationHistory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
use Doctrine\ORM\Mapping as ORM;

/**
* Class VacuumRelationHistoric
* @package Victoire\DevTools\VacuumBundle\Entity
* Class VacuumRelationHistoric.
*
* @ORM\Entity
* @ORM\InheritanceType("SINGLE_TABLE")
Expand Down Expand Up @@ -51,11 +50,13 @@ public function getId()

/**
* @param int $id
*
* @return AbstractVacuumRelationHistory
*/
public function setId(int $id)
{
$this->id = $id;

return $this;
}

Expand All @@ -69,11 +70,13 @@ public function getVicClass()

/**
* @param string $vicClass
*
* @return AbstractVacuumRelationHistory
*/
public function setVicClass(string $vicClass)
{
$this->vicClass = $vicClass;

return $this;
}

Expand All @@ -87,11 +90,13 @@ public function getVicId()

/**
* @param int $vicId
*
* @return AbstractVacuumRelationHistory
*/
public function setVicId(int $vicId)
{
$this->vicId = $vicId;

return $this;
}
}
}
11 changes: 7 additions & 4 deletions Entity/VacuumXMLRelationHistory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
use Doctrine\ORM\Mapping as ORM;

/**
* Class VacuumRelationHistoric
* @package Victoire\DevTools\VacuumBundle\Entity
* Class VacuumRelationHistoric.
*
* @ORM\Entity
*/
class VacuumXMlRelationHistory extends AbstractVacuumRelationHistory
class VacuumXMLRelationHistory extends AbstractVacuumRelationHistory
{
/**
* @var string
Expand All @@ -36,11 +35,13 @@ public function getTagName()

/**
* @param string $tagName
*
* @return VacuumXMlRelationHistory
*/
public function setTagName(string $tagName)
{
$this->tagName = $tagName;

return $this;
}

Expand All @@ -54,11 +55,13 @@ public function getTagId()

/**
* @param int $tagId
*
* @return VacuumXMlRelationHistory
*/
public function setTagId(int $tagId)
{
$this->tagId = $tagId;

return $this;
}
}
}
9 changes: 6 additions & 3 deletions Entity/WordPress/AbstractXMLEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
namespace Victoire\DevTools\VacuumBundle\Entity\WordPress;

/**
* Class XMLEntity
* @package Victoire\DevTools\VacuumBundle\Entity\WordPress
* Class XMLEntity.
*/
abstract class AbstractXMLEntity
{
Expand All @@ -28,11 +27,13 @@ public function getId()

/**
* @param int $id
*
* @return AbstractXMLEntity
*/
public function setId(int $id)
{
$this->id = $id;

return $this;
}

Expand All @@ -46,11 +47,13 @@ public function getXmlTag()

/**
* @param string $xmlTag
*
* @return AbstractXMLEntity
*/
public function setXmlTag(string $xmlTag)
{
$this->xmlTag = $xmlTag;

return $this;
}
}
}
Loading

0 comments on commit 63cae0f

Please sign in to comment.