Showing 9 of 17 total issues
SimplePoll
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class SimplePoll extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
/**
* The question of the poll
*
Function listAction
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function listAction()
{
// Use stdWrap for settings.simplepoll.uid
if (isset($this->settings['simplepoll']['useStdWrap']) && !empty($this->settings['simplepoll']['useStdWrap'])) {
- 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 listAction
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function listAction()
{
// Use stdWrap for settings.simplepoll.uid
if (isset($this->settings['simplepoll']['useStdWrap']) && !empty($this->settings['simplepoll']['useStdWrap'])) {
Function checkVoteOkFromIp
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function checkVoteOkFromIp(\Pixelink\Simplepoll\Domain\Model\SimplePoll $simplePoll, $onlyCheck = false)
{
$ipBlock = $this->settings['ipBlock'];
if (!(strtolower($ipBlock) == 'true' || $ipBlock == '1')) {
// IPs are not blocked, so the user can vote
- 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 voteAction
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function voteAction(\Pixelink\Simplepoll\Domain\Model\SimplePoll $simplePoll)
{
if ($this->request->hasArgument('simplePollRadio')) {
$voteId = $this->request->getArgument('simplePollRadio');
} 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 checkVoteOkFromCookie
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function checkVoteOkFromCookie(\Pixelink\Simplepoll\Domain\Model\SimplePoll $simplePoll, $onlyCheck = false)
{
// get the settings for cookie blocking
$cookieBlock = $this->settings['cookieBlock'];
if (!(strtolower($cookieBlock) == 'true' || $cookieBlock == '1')) {
- 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 checkVoteOkFromIp
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function checkVoteOkFromIp(\Pixelink\Simplepoll\Domain\Model\SimplePoll $simplePoll, $onlyCheck = false)
{
$ipBlock = $this->settings['ipBlock'];
if (!(strtolower($ipBlock) == 'true' || $ipBlock == '1')) {
// IPs are not blocked, so the user can vote
Method voteAction
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function voteAction(\Pixelink\Simplepoll\Domain\Model\SimplePoll $simplePoll)
{
if ($this->request->hasArgument('simplePollRadio')) {
$voteId = $this->request->getArgument('simplePollRadio');
} else {
Function cleanupIpLocks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function cleanupIpLocks(\Pixelink\Simplepoll\Domain\Model\SimplePoll $simplePoll)
{
// get the interval from the settigs which tell how long a user is not allowed to vote again
$garbageCollectorInterval = $this->settings['garbageCollectorInterval'];
$currentTime = new \DateTime;
- 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"