Showing 76 of 103 total issues
Method sendMailAction
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function sendMailAction()
{
$email = $this->request->request->get('email');
if ($email === null) {
throw new MissingArgumentException('email');
Method parse
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function parse($markdown)
{
if (!is_string($markdown)) {
throw new InvalidArgumentException('markdown', 'type_invalid');
}
Method vote
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function vote(\MongoCollection $collection, array $query, $uid, $value)
{
if ($value !== 1 && $value !== -1) {
throw new InvalidArgumentException('value', 'value_invalid');
}
Method onEvent
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function onEvent(GenericEvent $event, $eventName)
{
if (!$this->enforceHttps) {
return;
}
Function onEvent
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function onEvent(GenericEvent $event, $eventName)
{
if (!$this->enforceHttps) {
return;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function createReply
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function createReply(\MongoId $commentId, $ref, $owner, $markdown)
{
if (!is_string($ref)) {
throw new InvalidArgumentException('ref', 'type_invalid');
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method verify
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function verify($password, $salt, $hash)
{
$component = explode('|', $hash);
if (count($component) < 2) {
return false;
Method deleteReply
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function deleteReply(\MongoId $commentId, $ref, \MongoId $replyId)
{
if (!is_string($ref)) {
throw new InvalidArgumentException('ref', 'type_invalid');
}
Method testBatchQueryTopic
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testBatchQueryTopic()
{
$cursor = [
['topicId' => new \MongoId('5063114bd386d8fadbd6b004'), '_id' => 1],
['topicId' => new \MongoId('5063114bd386d8fadbd6b005'), '_id' => 2],
Function initConfig
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private static function initConfig()
{
if (file_exists(self::$CONFIG_DIRECTORY . '/config.yml')) {
// config file exists
$cachePath = self::$CACHE_DIRECTORY . '/config.php';
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function checkPasswordCredential
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function checkPasswordCredential($field, $password, $secretly = false)
{
if (Validator::email()->validate($field)) {
$user = UserUtil::getUserObjectByEmail($field);
} else {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function createProblem
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function createProblem($uid, $title, array $visibleDomains)
{
if (!Validator::int()->validate($uid)) {
throw new InvalidArgumentException('uid', 'type_invalid');
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function execute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$helper = $this->getHelper('question');
if ($input->getOption('type') !== 'vijos') {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __construct
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($category, $subCategory = null)
{
if (!is_string($category)) {
throw new InvalidArgumentException('category', 'type_invalid');
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function modifyReply
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function modifyReply(\MongoId $commentId, $ref, \MongoId $replyId, $markdown)
{
if (!is_string($ref)) {
throw new InvalidArgumentException('ref', 'type_invalid');
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function modifyComment
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function modifyComment(\MongoId $commentId, $ref, $markdown)
{
if (!is_string($ref)) {
throw new InvalidArgumentException('ref', 'type_invalid');
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function handle
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function handle()
{
if (!$this->isAjaxRequest()) {
return Handler::DONE;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function encode
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function encode($password, $salt, $type, $username = null)
{
if (strlen($salt) < 22) {
throw new InvalidArgumentException('salt', 'too_short');
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method onEvent
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function onEvent(GenericEvent $event, $eventName, $type, $user, $field = null, $password = null)
Method generate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function generate($purpose, $identifier, $expireAt, $data = null, $length = 30)