includes/components/new.php
Method createClip
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createClip($url)
{
noteLimit();
$err = "";
Function createClip
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
function createClip($url)
{
noteLimit();
$err = "";
- 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
Call to method __construct
from undeclared class \mysqli
Open
Open
$conn = new mysqli($_ENV['DB_SERVER'], $_ENV['USERNAME'], $_ENV['PASSWORD'], $_ENV['DB_NAME']);
- Exclude checks
Call to method prepare
from undeclared class \mysqli
Open
Open
$stmt = $conn->prepare('SELECT * FROM userurl WHERE usr = ?');
- Exclude checks
Call to method prepare
from undeclared class \mysqli
Open
Open
$stmt = $conn->prepare('INSERT INTO userurl (usr, url, date, expires) VALUES (?, ?, NOW(), ?)');
- Exclude checks
Reference to instance property connect_error
from undeclared class \mysqli
Open
Open
if ($conn->connect_error) {
- Exclude checks
Reference to instance property connect_error
from undeclared class \mysqli
Open
Open
if ($conn->connect_error) {
- Exclude checks
Call to method prepare
from undeclared class \mysqli
Open
Open
$stmt = $conn->prepare('SELECT * FROM userurl WHERE url = ?');
- Exclude checks
Reference to instance property connect_error
from undeclared class \mysqli
Open
Open
die("Connection failed: " . $conn->connect_error);
- Exclude checks
Call to method prepare
from undeclared class \mysqli
Open
Open
$stmt = $conn->prepare('SELECT * FROM userurl WHERE url = ?');
- Exclude checks
Call to method close
from undeclared class \mysqli
Open
Open
$conn->close();
- Exclude checks
Returning type array{0:string,1:''|string}
but createClip()
is declared to return void
Open
Open
return [$usr, $err];
- Exclude checks
Call to method close
from undeclared class \mysqli
Open
Open
$conn->close();
- Exclude checks
Call to method __construct
from undeclared class \mysqli
Open
Open
$conn = new mysqli($_ENV['DB_SERVER'], $_ENV['USERNAME'], $_ENV['PASSWORD'], $_ENV['DB_NAME']);
- Exclude checks
Reference to instance property connect_error
from undeclared class \mysqli
Open
Open
die("Connection failed: " . $conn->connect_error);
- Exclude checks
Reference to instance property error
from undeclared class \mysqli
Open
Open
$err = "Error inserting clip: <br>" . $conn->error;
- Exclude checks