Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace evgeniydev;
- use Exception;
- class FilterDump
- {
- private $sourceFile;
- private $outputFile;
- public function __construct($sourceFile, $outputFile = null)
- {
- if ($this->isBadFile($sourceFile)) {
- throw new Exception("Bad file");
- }
- if (is_null($outputFile)) {
- $outputFile = __DIR__ . DIRECTORY_SEPARATOR . 'output.xml';
- }
- $this->outputFile = $outputFile;
- $this->sourceFile = $sourceFile;
- }
- public function filterDump()
- {
- // logic filter data;
- }
- private function isBadFile($sourceFile)
- {
- if (!file_exists($sourceFile) || !is_file($sourceFile) || !is_readable($sourceFile)) {
- return true;
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement