Fixed PSR-2

This commit is contained in:
Eric Wheeler 2015-10-23 14:14:29 -07:00
parent 42b5da2e39
commit f61ff02693
2 changed files with 41 additions and 31 deletions

View File

@ -5,7 +5,6 @@
namespace Sikofitt\Hathor\Command;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
@ -15,14 +14,15 @@ use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Command\Command as BaseCommand;
use Sikofitt\Hathor\Common\Music\ID3;
class ScannerCommand extends BaseCommand {
class ScannerCommand extends BaseCommand
{
protected function configure()
{
$this
->setName('scan')
->setDescription('Scans Music')
->addArgument('file',InputArgument::OPTIONAL, 'the file to work on');
->addArgument('file', InputArgument::OPTIONAL, 'the file to work on');
}
protected function execute(InputInterface $input, OutputInterface $output)
@ -44,7 +44,7 @@ class ScannerCommand extends BaseCommand {
$progress = new ProgressBar($output, $finder->count());
$progress->setFormat("debug");
$progress->start();
foreach($finder as $file) {
foreach ($finder as $file) {
$progress->setOverwrite(true);
$progress->setMessage($file->getFilename());
$progress->advance();
@ -54,5 +54,4 @@ class ScannerCommand extends BaseCommand {
//$getID3->setFile($input->getArgument('file'))->getFileData()->dumpAll();
}
}

View File

@ -5,7 +5,6 @@
namespace Sikofitt\Hathor\Common\Music;
use Symfony\Component\VarDumper\VarDumper;
class ID3 extends \getID3
@ -19,15 +18,16 @@ class ID3 extends \getID3
const IS_VORBIS = 3;
const IS_UNKNOWN = 4;
public function __construct($file = null) {
public function __construct($file = null)
{
parent::__construct();
if(!is_null($file))
{
if (!is_null($file)) {
$this->file = $file;
}
}
public function setFile($file) {
public function setFile($file)
{
$this->file = $file;
return $this;
}
@ -35,37 +35,43 @@ class ID3 extends \getID3
/**
* @return null
*/
public function getFile() {
public function getFile()
{
return $this->file ?: $this->file;
}
public function getFileData() {
public function getFileData()
{
$this->fileData = $this->analyze($this->getFile());
if(isset($this->fileData['error']))
{
if (isset($this->fileData['error'])) {
throw new \RuntimeException(implode(' ', $this->fileData['error']));
} else {
return $this;
}
}
public function extractV2() {
public function extractV2()
{
return [
];
}
public function extractV1() {
public function extractV1()
{
}
public function extractAsf() {
public function extractAsf()
{
}
public function extractVorbis() {
public function extractVorbis()
{
}
public function extractDefaultData() {
switch($this->typeOfTag()) {
public function extractDefaultData()
{
switch ($this->typeOfTag()) {
case $this::IS_ID3V2:
break;
case $this::IS_ID3V1:
@ -80,13 +86,14 @@ class ID3 extends \getID3
break;
}
}
public function typeOfTag() {
public function typeOfTag()
{
if($this->hasId3v2()) {
if ($this->hasId3v2()) {
return $this::IS_ID3V2;
} elseif($this->hasId3v1()) {
} elseif ($this->hasId3v1()) {
return $this::IS_ID3V1;
} elseif($this->isAsf()) {
} elseif ($this->isAsf()) {
return $this::IS_ASF;
} else {
return $this::IS_UNKNOWN;
@ -96,29 +103,33 @@ class ID3 extends \getID3
/**
* @return bool
*/
public function hasId3v2() {
public function hasId3v2()
{
return isset($this->fileData['id3v2']);
}
/**
* @return bool
*/
public function hasId3v1() {
public function hasId3v1()
{
return isset($this->fileData['id3v1']);
}
/**
* @return bool
*/
public function isAsf() {
public function isAsf()
{
return isset($this->fileData['asf']);
}
/**
* @return null
*/
public function dumpAll() {
if(isset($this->fileData)) {
public function dumpAll()
{
if (isset($this->fileData)) {
unset($this->fileData['tags']);
unset($this->fileData['asf']);
VarDumper::dump($this->fileData);