code style

This commit is contained in:
El RIDO 2016-07-18 15:13:56 +02:00
parent 918de8f0c4
commit afaa111d22
4 changed files with 18 additions and 14 deletions

View File

@ -386,7 +386,7 @@ class i18n
protected static function _matchLanguage($a, $b) {
$a = explode('-', $a);
$b = explode('-', $b);
for ($i=0, $n=min(count($a), count($b)); $i<$n; $i++)
for ($i=0, $n = min(count($a), count($b)); $i < $n; ++$i)
{
if ($a[$i] !== $b[$i]) break;
}

View File

@ -45,13 +45,16 @@ abstract class persistence
* @access public
* @static
* @param string $filename
* @return void
* @return string
*/
public static function getPath($filename = null)
{
if(strlen($filename)) {
if (strlen($filename))
{
return self::$_path . DIRECTORY_SEPARATOR . $filename;
} else {
}
else
{
return self::$_path;
}
}
@ -116,7 +119,8 @@ abstract class persistence
self::_initialize();
$file = self::$_path . DIRECTORY_SEPARATOR . $filename;
$writtenBytes = @file_put_contents($file, $data, LOCK_EX);
if ($writtenBytes === false || $writtenBytes < strlen($data)) {
if ($writtenBytes === false || $writtenBytes < strlen($data))
{
throw new Exception('unable to write to file ' . $file, 13);
}
@chmod($file, 0640); // protect file access