More bug fixes

This commit is contained in:
Dennis Eichhorn 2016-03-27 23:08:58 +02:00
parent 8ebdf58d34
commit 7cc423281c
3 changed files with 10 additions and 6 deletions

View File

@ -134,7 +134,7 @@ abstract class DataMapperAbstract implements DataMapperInterface
/**
* Fields to load.
*
* @var string[]
* @var array[]
* @since 1.0.0
*/
protected $fields = [];
@ -404,6 +404,8 @@ abstract class DataMapperAbstract implements DataMapperInterface
if (isset(static::$hasMany[$pname]['mapper']) && static::$hasMany[$pname]['mapper'] === static::$hasMany[$pname]['relationmapper']) {
$relReflectionClass = new \ReflectionClass(get_class($temp));
} else {
// todo: init other $relReflectionClass?!
}
foreach ($values as $key => &$value) {
@ -853,13 +855,14 @@ abstract class DataMapperAbstract implements DataMapperInterface
* Get all by custom query.
*
* @param Builder $query Query
* @param bool $relations Relations
*
* @return array
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function getAllByQuery(Builder $query) : array
public function getAllByQuery(Builder $query, bool $relations = true) : array
{
$sth = $this->db->con->prepare($query->toSql());
$sth->execute();

View File

@ -339,7 +339,7 @@ class Matrix implements ArrayAccess, Iterator
}
$trianglize = $this->matrix;
$prod = $this->(upperTrianglize($trianglize));
$prod = $this->upperTrianglize($trianglize);
for($i = 0; $i < $this->n; $i++) {
$prod *= $trianglize[$i][$i];

View File

@ -64,8 +64,9 @@ class Numbers
*/
public static function selfdescribing(int $n) : bool
{
foreach (str_split($n) as $place => $value) {
if (substr_count($number, $place) != $value) {
$split = str_split($n);
foreach ($split as $place => $value) {
if (substr_count($n, $place) != $value) {
return false;
}
}
@ -85,7 +86,7 @@ class Numbers
*/
public static function isSquare(int $n) : bool
{
$goodMask; // 0xC840C04048404040 computed below
$goodMask = 0xC840C04048404040; // 0xC840C04048404040 computed below
for ($i = 0; $i < 64; ++$i) {
$goodMask |= PHP_INT_MIN >> ($i*$i);