Skip to content

Commit

Permalink
Improvements
Browse files Browse the repository at this point in the history
Added construct to AbstractAdapter with basePath, Added exception, Added
INI, STR, XML parse. Fixed unused variable in mime method
  • Loading branch information
VeeeneX committed Jul 24, 2015
1 parent 7d88b36 commit b46c221
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 63 deletions.
22 changes: 5 additions & 17 deletions src/AbstractAdapter.php
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
<?php

/**
* Aurora - Framework
*
* Aurora is fast, simple, extensible Framework
*
* PHP version 6
*
* @category Framework
* @package Aurora
* @author VeeeneX <[email protected]>
* @copyright 2015 Caroon
* @license MIT
* @version 0.1.2
* @link http://caroon.com/Aurora
*
*/

namespace Aurora;

class AbstractAdapter implements AdapterInterface
{
public $basePath;
public $extension;

public function __construct($basePath)
{
$this->basePath = $basePath;
}

public function setBasePath($basePath)
{
$this->basePath = $basePath;
Expand Down
7 changes: 7 additions & 0 deletions src/Adapter/Exception/UnableToParseFormatException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Aurora\Adapter\Exception;

use Exception;

class UnableToParseFormatException extends Exception {}
14 changes: 14 additions & 0 deletions src/Adapter/INI.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
namespace Aurora\Adapter;

use Aurora\AbstractAdapter;

class INI extends AbstractAdapter
{
public $extension = ".ini";

public function parse($data)
{
return parse_ini_string($data);
}
}
18 changes: 0 additions & 18 deletions src/Adapter/JSON.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,4 @@
<?php

/**
* Aurora - Framework
*
* Aurora is fast, simple, extensible Framework
*
* PHP version 6
*
* @category Framework
* @package Aurora
* @author VeeeneX <[email protected]>
* @copyright 2015 Caroon
* @license MIT
* @version 0.1.2
* @link http://caroon.com/Aurora
*
*/

namespace Aurora\Adapter;

use Aurora\AbstractAdapter;
Expand Down
19 changes: 1 addition & 18 deletions src/Adapter/PHP.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,9 @@
<?php

/**
* Aurora - Framework
*
* Aurora is fast, simple, extensible Framework
*
* PHP version 6
*
* @category Framework
* @package Aurora
* @author VeeeneX <[email protected]>
* @copyright 2015 Caroon
* @license MIT
* @version 0.1.2
* @link http://caroon.com/Aurora
*
*/

namespace Aurora\Adapter;

use Aurora\AbstractAdapter;
use Aurora\Exception\UnableToParseFormatException;
use Aurora\Adapter\Exception\UnableToParseFormatException;

class PHP extends AbstractAdapter
{
Expand Down
14 changes: 14 additions & 0 deletions src/Adapter/STR.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
namespace Aurora\Adapter;

use Aurora\AbstractAdapter;

class STR extends AbstractAdapter
{
public $extension = ".str";

public function parse($data)
{
return parse_str($data);
}
}
17 changes: 17 additions & 0 deletions src/Adapter/XML.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
namespace Aurora\Adapter;

use Aurora\AbstractAdapter;

class XML extends AbstractAdapter
{
public $extension = ".xml";

public function parse($data)
{
$p = xml_parser_create();
xml_parse_into_struct($p, $data, $vals, $index);
xml_parser_free($p);
return $vals;
}
}
9 changes: 0 additions & 9 deletions src/Exception/UnableToParseFormatException.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/FileSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static function extension($file)
return pathinfo($file, PATHINFO_EXTENSION);
}

public static function mime($file, $guess = true)
public static function mime($file)
{
if (function_exists('finfo_open')) {
$info = finfo_open(FILEINFO_MIME_TYPE);
Expand Down

0 comments on commit b46c221

Please sign in to comment.