Skip to content
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

Refactoring #252

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
13 changes: 0 additions & 13 deletions src/Core/Base/Timestamp.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,6 @@ public function __construct($dateTime, \DateTimeZone $zone=null)

}

private function getDefaultTimeZone()
{
try {
$defaultTimeZoneName = date_default_timezone_get();
return new \DateTimeZone($defaultTimeZoneName);
} catch(\Exception $e) {
throw new WrongStateException(
"strange default time zone given - '{$defaultTimeZoneName}'!".
'Use date_default_timezone_set() for set valid default time zone.'
);
}
}

public function toTime($timeDelimiter = ':', $secondDelimiter = '.')
{
return
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Cache/AggregateCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected function guessLabel($key)
}

// init by $key, randomness will be restored later
mt_srand(hexdec(substr(md5($key), 3, 7)));
mt_srand(intval(hexdec(substr(md5($key), 3, 7))));

$zeroDistances = array();
$weights = array();
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Form/FormUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ final class FormUtils extends StaticFactory
$proto = $object->proto();

foreach (array_keys($proto->getExpandedPropertyList()) as $name) {
if ($form->primitiveExists($name)) {
if ($form->exists($name)) {
$proto->importPrimitive(
$name,
$form,
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Form/MappedForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function export(RequestType $type)
**/
private function checkExistence($name)
{
if (!$this->form->primitiveExists($name))
if (!$this->form->exists($name))
throw new MissingElementException(
"there is no '{$name}' primitive"
);
Expand Down
8 changes: 2 additions & 6 deletions src/Core/Form/Primitives/DateRangeList.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,9 @@ public static function makeRange($string)

if ($start || $finish) {

$range = new DateRange();

$range =
return
DateRange::create()->
lazySet($start, $finish);

return $range;
lazySet($start, $finish);

} elseif (trim($string) == '-')
return DateRange::create();
Expand Down
1 change: 0 additions & 1 deletion src/Core/Form/Primitives/PrimitiveDateRange.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public function importValue($value)
public function import($scope)
{
if (parent::import($scope)) {
$listName = $this->getObjectName().'List';
try {
$range = $this->makeRange($scope[$this->name]);
} catch (WrongArgumentException $e) {
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Form/Primitives/TimeList.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static function stringToTimeList($string)
{
$list = array();

$times = split("([,; \n]+)", $string);
$times = preg_split("([,; \n]+)", $string);

for ($i = 0, $size = count($times); $i < $size; ++$i) {
$time = mb_ereg_replace('[^0-9:]', ':', $times[$i]);
Expand Down
2 changes: 1 addition & 1 deletion src/Main/Charts/Google/GoogleChart.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public function toString()
$url = self::BASE_URL;

Assert::isNotNull($this->type);
$parameters[] = $this->type->toString();
$parameters = array($this->type->toString());

Assert::isNotNull($this->size);
$parameters[] = $this->size->toString();
Expand Down
2 changes: 0 additions & 2 deletions src/Main/Charts/Google/GoogleChartLabelStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ public function toString()

Assert::isNotEmptyArray($this->styles);

$i = 0;

foreach ($this->styles as $style)
$queryString .= $style->toString().'|';

Expand Down
1 change: 1 addition & 0 deletions src/Main/Charts/Google/GoogleChartSolidFillCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public function toString()
{
$fillerString = GoogleChartSolidFill::getParamName().'=';

$filters = array();
foreach ($this->fillers as $filler)
$fillers[] = $filler->toString();

Expand Down
11 changes: 0 additions & 11 deletions src/Main/Criteria/Criteria.php
Original file line number Diff line number Diff line change
Expand Up @@ -664,16 +664,5 @@ private function joinProperties(
}
}
}

/**
* @return AbstractProtoClass
**/
private function getProto()
{
return
call_user_func(
array($this->checkAndGetDao()->getObjectName(), 'proto')
);
}
}
?>
1 change: 0 additions & 1 deletion src/Main/DAO/ProtoDAO.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ public function fetchCollections(
$propertyPath = $info['propertyPath'];

$property = $propertyPath->getFinalProperty();
$proto = $propertyPath->getFinalProto();
$dao = $propertyPath->getFinalDao();

$selfName = $this->getObjectName();
Expand Down
2 changes: 1 addition & 1 deletion src/Main/DAO/Uncacher/UncacherTaggableDaoWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function uncache()
$worker->expireTags($tags);

foreach ($idKeys as $key)
Cache::me()->mark($className)->delete($idKey);
Cache::me()->mark($className)->delete($key);

ClassUtils::callStaticMethod("$className::dao")->uncacheLists();
}
Expand Down
2 changes: 0 additions & 2 deletions src/Main/DAO/Worker/SmartDaoWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ protected function cacheByQuery(
$expires = Cache::EXPIRES_FOREVER
)
{
$queryId = $query->getId();

$semKey = $this->keyToInt($this->indexKey);

$key = $this->makeQueryKey($query, self::SUFFIX_QUERY);
Expand Down
2 changes: 0 additions & 2 deletions src/Main/EntityProto/EntityProto.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ final public function validateSelf(
? $previousGetter->get($id)
: null;

$childResult = true;

if (
$child
&& !$proto->validate(
Expand Down
22 changes: 0 additions & 22 deletions src/Main/Markup/Html/HtmlTokenizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,28 +284,6 @@ private function reset()
return $this;
}

/**
* @return HtmlTokenizer
**/
private function skip($count)
{
for ($i = 0; $i < $count; ++$i)
$this->getNextChar();

return $this;
}

private function lookAhead($count)
{
$this->stream->mark();

$result = $this->stream->read($count);

$this->stream->reset();

return $result;
}

private function skipString($string, $skipSpaces = false)
{
$this->mark();
Expand Down
2 changes: 2 additions & 0 deletions src/Main/Math/MathUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public static function makeCartesianProduct(
$size *= sizeof($array);

$keys = array_keys($arrays);
$tmpArrays = array();

foreach ($keys as $key)
$tmpArrays[] = $arrays[$key];
Expand Down Expand Up @@ -86,6 +87,7 @@ public static function applyFunctorToCartesianProduct(
$size *= sizeof($array);

$keys = array_keys($arrays);
$tmpArrays = array();

foreach ($keys as $key)
$tmpArrays[] = $arrays[$key];
Expand Down
18 changes: 1 addition & 17 deletions src/Main/Util/ClassUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,23 +137,7 @@ public static function isSameClassNames($left, $right)
/// to avoid dependency on SPL's class_implements
public static function isClassImplements($what)
{
static $classImplements = null;

if (!$classImplements) {
if (!function_exists('class_implements')) {
$classImplements = create_function(
'$what',
'
$info = new \ReflectionClass($what);
return $info->getInterfaceNames();
'
);
} else {
$classImplements = 'class_implements';
}
}

return $classImplements($what, true);
return class_implements($what, true);
}

public static function isInstanceOf($object, $class)
Expand Down
8 changes: 4 additions & 4 deletions src/Meta/Console/MetaOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ public function warningLine($text)
**/
public function error($text, $bold = false)
{
return $this->errorText($text, ConsoleMode::FG_RED, $bold);
return $this->errorText($text);
}

/**
* @return MetaOutput
**/
public function errorLine($text, $bold = false)
{
return $this->errorTextLine($text, ConsoleMode::FG_RED, $bold);
return $this->errorTextLine($text);
}

/**
Expand Down Expand Up @@ -162,7 +162,7 @@ private function defaultTextLine($text, $color, $bold)
/**
* @return MetaOutput
**/
private function errorText($text, $color, $bold)
private function errorText($text)
{
if ($this->out instanceof ColoredTextOutput)
$text = $this->out->wrapString($text);
Expand All @@ -175,7 +175,7 @@ private function errorText($text, $color, $bold)
/**
* @return MetaOutput
**/
private function errorTextLine($text, $color, $bold)
private function errorTextLine($text)
{
if ($this->out instanceof ColoredTextOutput)
$text = $this->out->wrapString($text);
Expand Down
5 changes: 0 additions & 5 deletions src/Meta/Entity/MetaClassProperty.php
Original file line number Diff line number Diff line change
Expand Up @@ -546,10 +546,5 @@ private function buildColumn($columnName)

return $column;
}

private function toVarName($name)
{
return strtolower($name[0]).substr($name, 1);
}
}
?>
1 change: 0 additions & 1 deletion src/Meta/Entity/MetaConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,6 @@ public function buildContainers()
&& ($property->getRelationId() != MetaRelation::ONE_TO_ONE)
) {
$relation = $class->getName() . ucfirst($property->getName()) . 'DAO';
$userFile1 = NamespaceUtils::getDAODir($class) . DIRECTORY_SEPARATOR . $relation . EXT_CLASS;
$userFile =
ONPHP_META_DAO_DIR
.$class->getName().ucfirst($property->getName())
Expand Down