forked from ua-parser/uap-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
81 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
/** | ||
* ua-parser | ||
* | ||
* Copyright (c) 2011-2012 Dave Olsen, http://dmolsen.com | ||
* | ||
* Released under the MIT license | ||
*/ | ||
namespace UAParser\Command; | ||
|
||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Filesystem\Filesystem; | ||
use UAParser\Util\Fetcher; | ||
|
||
class FetchCommand extends Command | ||
{ | ||
protected function configure() | ||
{ | ||
$this | ||
->setName('ua-parser:update') | ||
->setDescription('Fetches an updated YAML file for ua-parser and overwrites the current JSON file.') | ||
->addArgument( | ||
'file', | ||
InputArgument::REQUIRED, | ||
'regexes.yaml output file' | ||
) | ||
; | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$fs = new Filesystem(); | ||
$fetcher = new Fetcher(); | ||
$fs->dumpFile($input->getArgument('file'), $fetcher->fetch()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
/** | ||
* ua-parser | ||
* | ||
* Copyright (c) 2011-2012 Dave Olsen, http://dmolsen.com | ||
* | ||
* Released under the MIT license | ||
*/ | ||
namespace UAParser\Tests\Util; | ||
|
||
use PHPUnit_Framework_TestCase as AbstractTestCase; | ||
use UAParser\Util\Fetcher; | ||
|
||
/** | ||
* @group online | ||
*/ | ||
class FetcherTest extends AbstractTestCase | ||
{ | ||
|
||
/** @var Fetcher */ | ||
private $fetcher; | ||
|
||
public function setUp() | ||
{ | ||
$this->fetcher = new Fetcher(); | ||
} | ||
|
||
public function testFetch() | ||
{ | ||
$this->assertInternalType('string', $this->fetcher->fetch()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.