Showing 14 of 14 total issues
Function delete
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function delete(
string $cookieName,
string $domain = null
) : CookieCollectionInterface {
if ($domain === null) {
- 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 generateFileOutput
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function generateFileOutput(
CookieCollectionInterface $cookies
) {
$output = '';
- 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 persist
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function persist(
CookieCollectionInterface $cookies,
string $filename
) : PersisterInterface {
if (empty($this->getConfiguration()->getCookieDir())) {
- 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 persist
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function persist(
CookieCollectionInterface $cookies,
string $filename
) : PersisterInterface {
if (empty($this->getConfiguration()->getCookieDir())) {
Method generateFileOutput
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function generateFileOutput(
CookieCollectionInterface $cookies
) {
$output = '';
Function parseContent
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function parseContent(string $filecontent
) : CookieCollectionInterface {
$cookies = new CookieCollection();
foreach (explode("\n", $filecontent) as $line) {
- 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 parseContent
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function parseContent(string $filecontent
) : CookieCollectionInterface {
$cookies = new CookieCollection();
foreach (explode("\n", $filecontent) as $line) {
Function setCookies
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function setCookies(array $cookies) : CookieCollectionInterface
{
$this->cookies = [];
foreach ($cookies as $cookie) {
- 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 setCookies
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setCookies(array $cookies) : CookieCollectionInterface
{
$this->cookies = [];
foreach ($cookies as $cookie) {
Method parseFile
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function parseFile(string $file) : CookieCollectionInterface
{
if (!($this->getConfiguration() instanceof ConfigurationInterface)) {
throw new ParserException(
'You need to inject configurations in order to parse a file'
Function add
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function add(
CookieInterface $cookie
) : CookieCollectionInterface {
$cookieDomain = $cookie->getDomain();
$cookieName = $cookie->getName();
- 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 getAll
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getAll(string $domain = null) : CookieCollectionInterface
{
if ($domain === null) {
return $this;
} 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 has
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function has(string $cookieName, string $domain = null) : bool
{
if ($domain === null) {
/*find this cookie for all domains*/
- 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 get
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function get(string $cookieName, string $domain = null)
{
if ($domain === null) {
/*find the first occurence on any domain*/
- 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"