Improve codestyle

This commit is contained in:
Dennis Eichhorn 2018-02-03 10:30:13 +01:00
parent f1288ebc03
commit e4dadf447d
60 changed files with 274 additions and 309 deletions

View File

@ -85,5 +85,4 @@ interface ConnectionInterface
* @since 1.0.0 * @since 1.0.0
*/ */
public function getSchemaGrammar() : SchemaGrammar; public function getSchemaGrammar() : SchemaGrammar;
} }

View File

@ -817,8 +817,7 @@ class DataMapperAbstract implements DataMapperInterface
private static function createRelationTable(string $propertyName, array $objsIds, $objId) private static function createRelationTable(string $propertyName, array $objsIds, $objId)
{ {
/** @var string $table */ /** @var string $table */
if ( if (!empty($objsIds)
!empty($objsIds)
&& static::$hasMany[$propertyName]['table'] !== static::$table && static::$hasMany[$propertyName]['table'] !== static::$table
&& static::$hasMany[$propertyName]['table'] !== static::$hasMany[$propertyName]['mapper']::$table && static::$hasMany[$propertyName]['table'] !== static::$hasMany[$propertyName]['mapper']::$table
) { ) {
@ -1003,8 +1002,7 @@ class DataMapperAbstract implements DataMapperInterface
private static function deleteRelationTable(string $propertyName, array $objsIds, $objId) private static function deleteRelationTable(string $propertyName, array $objsIds, $objId)
{ {
/** @var string $table */ /** @var string $table */
if ( if (!empty($objsIds)
!empty($objsIds)
&& static::$hasMany[$propertyName]['table'] !== static::$table && static::$hasMany[$propertyName]['table'] !== static::$table
&& static::$hasMany[$propertyName]['table'] !== static::$hasMany[$propertyName]['mapper']::$table && static::$hasMany[$propertyName]['table'] !== static::$hasMany[$propertyName]['mapper']::$table
) { ) {

View File

@ -51,7 +51,7 @@ class Fibunacci
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public static function fibunacci(int $n, int $start = 1) : int public static function fib(int $n, int $start = 1) : int
{ {
if ($n < 3) { if ($n < 3) {
return $start; return $start;

View File

@ -69,6 +69,7 @@ class Polygon implements D2ShapeInterface
{ {
$coord = $this->coord; $coord = $this->coord;
$coord[] = $this->coord[0]; $coord[] = $this->coord[0];
return self::isPointInPolygon($point, $coord); return self::isPointInPolygon($point, $coord);
} }
@ -204,7 +205,6 @@ class Polygon implements D2ShapeInterface
} }
$surface += $this->coord[$count - 1]['x'] * $this->coord[0]['y'] - $this->coord[0]['x'] * $this->coord[$count - 1]['y']; $surface += $this->coord[$count - 1]['x'] * $this->coord[0]['y'] - $this->coord[0]['x'] * $this->coord[$count - 1]['y'];
$surface /= 2; $surface /= 2;
return $surface; return $surface;

View File

@ -24,15 +24,4 @@ namespace phpOMS\Math\Matrix;
*/ */
class Vector extends Matrix class Vector extends Matrix
{ {
/**
* Constructor.
*
* @param int $m Columns
*
* @since 1.0.0
*/
public function __construct(int $m = 1)
{
parent::__construct($m);
}
} }

View File

@ -372,8 +372,7 @@ class Request extends RequestAbstract
throw new \OutOfRangeException('Value "' . $port . '" is out of range.'); throw new \OutOfRangeException('Value "' . $port . '" is out of range.');
} }
return return (!empty($_SERVER['HTTPS'] ?? '') && ($_SERVER['HTTPS'] ?? '') !== 'off')
(!empty($_SERVER['HTTPS'] ?? '') && ($_SERVER['HTTPS'] ?? '') !== 'off')
|| (($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '') === 'https') || (($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '') === 'https')
|| (($_SERVER['HTTP_X_FORWARDED_SSL'] ?? '') === 'on') || (($_SERVER['HTTP_X_FORWARDED_SSL'] ?? '') === 'on')
|| ($_SERVER['SERVER_PORT'] ?? '') == $port; || ($_SERVER['SERVER_PORT'] ?? '') == $port;

View File

@ -29,5 +29,5 @@ abstract class RequestSource extends Enum
/* public */ const WEB = 0; /* This is a http request */ /* public */ const WEB = 0; /* This is a http request */
/* public */ const CONSOLE = 1; /* Request is a console command */ /* public */ const CONSOLE = 1; /* Request is a console command */
/* public */ const SOCKET = 2; /* Request through socket connection */ /* public */ const SOCKET = 2; /* Request through socket connection */
/* public */ const UNDEFINED = 3; /* Request through socket connection */ /* public */ const UNDEFINED = 3;
} }

View File

@ -35,6 +35,6 @@ abstract class PacketType extends Enum
/* public */ const MSG = 6; /* Message (server/sender/client/all clients?) */ /* public */ const MSG = 6; /* Message (server/sender/client/all clients?) */
/* public */ const LOGIN = 7; /* Login (server/sender) */ /* public */ const LOGIN = 7; /* Login (server/sender) */
/* public */ const LOGOUT = 8; /* Logout (server/sender) */ /* public */ const LOGOUT = 8; /* Logout (server/sender) */
/* public */ const ACCMODIFY = 9; /* Account modification (server/sender (admin)/user) */ /* public */ const CMD = 9; /* Other command */
/* public */ const MODULE = 999999999; /* Module packet ??? */ /* public */ const MODULE = 999999999; /* Module packet ??? */
} }

View File

@ -44,14 +44,6 @@ class SmartDateTime extends \DateTime
*/ */
/* public */ const TIMEZONE = 'UTC'; /* public */ const TIMEZONE = 'UTC';
/**
* {@inheritdoc}
*/
public function __construct($time = 'now', $timezone = null)
{
parent::__construct($time, $timezone);
}
/** /**
* Create object from DateTime * Create object from DateTime
* *
@ -281,6 +273,7 @@ class SmartDateTime extends \DateTime
// add remaining days to next month (7*6 - difference+count of current month) // add remaining days to next month (7*6 - difference+count of current month)
$remainingDays = 42 - $diffToWeekStart - $daysMonth; $remainingDays = 42 - $diffToWeekStart - $daysMonth;
$nextMonth = $this->createModify(0, 1); $nextMonth = $this->createModify(0, 1);
for ($i = 1; $i <= $remainingDays; $i++) { for ($i = 1; $i <= $remainingDays; $i++) {
$days[] = new \DateTime($nextMonth->format('Y') . '-' . $nextMonth->format('m') . '-' . ($i)); $days[] = new \DateTime($nextMonth->format('Y') . '-' . $nextMonth->format('m') . '-' . ($i));
} }

View File

@ -32,7 +32,8 @@ class FtpStorage extends StorageAbstract
{ {
private static $instance = null; private static $instance = null;
public function __construct() { public function __construct()
{
} }

View File

@ -13,6 +13,7 @@
declare(strict_types = 1); declare(strict_types = 1);
namespace phpOMS\System\File\Local; namespace phpOMS\System\File\Local;
use phpOMS\System\File\StorageAbstract; use phpOMS\System\File\StorageAbstract;
use phpOMS\System\File\PathException; use phpOMS\System\File\PathException;

View File

@ -348,7 +348,9 @@ abstract class C128Abstract
private function calculateCodeLength(string $codeString) : int private function calculateCodeLength(string $codeString) : int
{ {
$codeLength = 0; $codeLength = 0;
for ($i = 1; $i <= strlen($codeString); $i++) { $length = strlen($codeString);
for ($i = 1; $i <= $length; $i++) {
$codeLength = $codeLength + (int) (substr($codeString, ($i - 1), 1)); $codeLength = $codeLength + (int) (substr($codeString, ($i - 1), 1));
} }

View File

@ -61,23 +61,6 @@ class C39 extends C128Abstract
*/ */
protected static $CODE_END = '121121211'; protected static $CODE_END = '121121211';
/**
* Constructor
*
* @param string $content Content to encrypt
* @param int $width Barcode width
* @param int $height Barcode height
* @param int $orientation Orientation of the barcode
*
* @todo : add mirror parameter
*
* @since 1.0.0
*/
public function __construct(string $content = '', int $width = 100, int $height = 20, int $orientation = OrientationType::HORIZONTAL)
{
parent::__construct($content, $width, $height, $orientation);
}
/** /**
* Set content to encrypt * Set content to encrypt
* *

View File

@ -25,11 +25,11 @@ class FibunacciTest extends \PHPUnit\Framework\TestCase
self::assertFalse(Fibunacci::isFibunacci(6)); self::assertFalse(Fibunacci::isFibunacci(6));
self::assertFalse(Fibunacci::isFibunacci(87)); self::assertFalse(Fibunacci::isFibunacci(87));
self::assertEquals(1, Fibunacci::fibunacci(1)); self::assertEquals(1, Fibunacci::fib(1));
self::assertTrue(Fibunacci::isFibunacci(Fibunacci::binet(3))); self::assertTrue(Fibunacci::isFibunacci(Fibunacci::binet(3)));
self::assertTrue(Fibunacci::isFibunacci(Fibunacci::binet(6))); self::assertTrue(Fibunacci::isFibunacci(Fibunacci::binet(6)));
self::assertEquals(Fibunacci::binet(6), Fibunacci::fibunacci(6)); self::assertEquals(Fibunacci::binet(6), Fibunacci::fib(6));
self::assertEquals(Fibunacci::binet(8), Fibunacci::fibunacci(8)); self::assertEquals(Fibunacci::binet(8), Fibunacci::fib(8));
} }
} }