Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
litmanowicziv committed Aug 9, 2016
1 parent fe9aac4 commit 2a2cf10
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
12 changes: 2 additions & 10 deletions src/Env.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,8 @@ function getMaxIterarions() {
return null;
}

function showInDebugEnv($var) {

if (isset($_REQUEST['debug']) && ($_REQUEST['debug'] == 'true')) {
new dBug($var);
}

if (php_sapi_name() === 'cli') {
print_r($var);
echo PHP_EOL;
}
function isCLI($var) {
return php_sapi_name() === 'cli';
}

?>
2 changes: 2 additions & 0 deletions src/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ function current() {
new dBug("record no. $this->_record_index");
new dBug($this->_entity);
}

return $this->_entity;
}

}
15 changes: 8 additions & 7 deletions tests/example.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,30 @@
require_once 'vendor/autoload.php';
require_once 'src/CSVFeed.php';
require_once 'src/XMLFeed.php';
require_once 'src/HTMLFeed.php';
require_once 'src/JSONFeed.php';

$files = './data';
$file = __DIR__ . "/data";
try {
if (isset($_REQUEST['input']))
switch ($_REQUEST['input']) {
case "tsv":
$reader = new CSVFeed("$files/tsv-example.txt", "\t");
$reader = new CSVFeed("$file/tsv-example.txt", "\t");
break;
case "csv":
$reader = new CSVFeed("$files/csv-example.csv", ",");
$reader = new CSVFeed("$file/csv-example.csv", ",");
break;
case "json":
$reader = new JSONFeed("$files/json-example.json");
$reader = new JSONFeed("$file/json-example.json");
break;
case "xml":
$reader = new XMLFeed("$files/xml-example.xml", "item");
$reader = new XMLFeed("$file/xml-example.xml", "item");
break;
default:
throw new Exception("Error: file wasn't choden");
}
} catch (Exception $e) {
print_r($e->getMessage());
new dBug($e->getMessage());
exit(1);
}

Expand All @@ -38,7 +39,7 @@
$reader->next();
$reader->current();
} catch (Exception $e) {
print_r($e->getMessage());
new dBug($e->getMessage());
continue;
}
}

0 comments on commit 2a2cf10

Please sign in to comment.