for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace nstdio\svg\util;
use nstdio\svg\ElementInterface;
/**
* Class Identifier
*
* @package nstdio\svg\util
* @author Edgar Asatryan <[email protected]>
*/
class Identifier
{
const FALLBACK_LENGTH = 5;
public static function sequential(ElementInterface $root, $tag)
$count = $root->getRoot()->getElement()->getElementsByTagName($tag)->length;
getElement()
DOMElement
getElementsByTagName()
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.
return $tag . (++$count);
}
public static function random($prefix, $length)
self::tryApplyFallback($length);
$prefix .= mt_rand(1, 9);
$length--;
for ($i = 0; $i < $length; $i++) {
$prefix .= mt_rand(0, 9);
return $prefix;
* @param $length
* @return int
private static function tryApplyFallback(&$length)
$length = intval($length);
if (!$length || $length <= 1) {
$length = self::FALLBACK_LENGTH;
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.