Skip to content

RC5 - codestyle #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 20, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 31 additions & 31 deletions src/Container/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,6 @@ public function __construct($sourcePath, $outputPath)
$this->outputPath = $outputPath;
}

public function getSourcePath()
{
return $this->sourcePath;
}

/**
* @param string $path
*
* @return File
*/
public function setSourcePath($path)
{
$this->sourcePath = $path;
$this->type = $this->detectSourceTypeFromPath($path);

return $this;
}

/**
* @return string
*/
Expand Down Expand Up @@ -117,6 +99,37 @@ public function setSourceContentFromSourcePath()
return $this;
}

/**
* @return string
* @throws FileException
*/
protected function readSourceContentByPath()
{
if (!file_exists($this->getSourcePath())) {
throw new FileException("file: {$this->sourcePath} doesn't exists");
}

return file_get_contents($this->getSourcePath());
}

public function getSourcePath()
{
return $this->sourcePath;
}

/**
* @param string $path
*
* @return File
*/
public function setSourcePath($path)
{
$this->sourcePath = $path;
$this->type = $this->detectSourceTypeFromPath($path);

return $this;
}

/**
* @return string
*/
Expand Down Expand Up @@ -170,17 +183,4 @@ protected function detectSourceTypeFromPath($path)
? $extension
: static::TYPE_UNKNOWN;
}

/**
* @return string
* @throws FileException
*/
protected function readSourceContentByPath()
{
if (!file_exists($this->getSourcePath())) {
throw new FileException("file: {$this->sourcePath} doesn't exists");
}

return file_get_contents($this->getSourcePath());
}
}