Skip to content

Commit

Permalink
Merge pull request #11 from znframework/5.9
Browse files Browse the repository at this point in the history
Fixed protected ZN\Generator::write() method.
  • Loading branch information
ozanuykun committed Sep 5, 2018
2 parents 3616732 + 808c330 commit 9d0431a
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions File.php
Expand Up @@ -158,32 +158,29 @@ protected function path($name, $type)
*/
protected function write($name, $type, $controller) : Bool
{
if( ! empty($this->settings['path']) )
if( ! empty($name) )
{
$filePath = Base::suffix($this->settings['path'], '/') . $name;
}
else
{
$filePath = $name;
}

$file = $this->path($filePath, $type);;

if( ! is_file($file) )
{
if( file_put_contents($file, $controller) )
if( ! empty($this->settings['path']) )
{
return true;
$filePath = Base::suffix($this->settings['path'], '/') . $name;
}
else
{
return false;
$filePath = $name;
}

$file = $this->path($filePath, $type);

if( ! is_file($file) )
{
if( file_put_contents($file, $controller) )
{
return true;
}
}
}
else
{
return false;
}

return false;
}

/**
Expand Down

0 comments on commit 9d0431a

Please sign in to comment.