Showing 81 of 119 total issues
Method alphaID
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function alphaID($in, $to_num = false, $pad_up = false, $pass_key = null) {
$out = '';
$index = 'abcdefghijklmnopqrstuvwxyz123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$base = strlen($index);
Function update
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
update: function(){
$("#list-newsfeed .header .edit").off('click').on('click', function() {
var newsfeedBody = $(this).parent().parent().parent().parent();
var newsfeedId = newsfeedBody.attr("id");
Function update
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
update: function(){
$("#list-comments .header .edit").off('click').on('click', function() {
var commentBody = $(this).parent().parent().parent().parent();
Method sendEmail
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function sendEmail($type, $email, $userData, $data){
$mail = new PHPMailer();
$mail->IsSMTP();
Method updateEmail
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateEmail($userId, $emailToken){
if (empty($userId) || empty($emailToken)) {
return false;
}
Function upload
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
upload: function(url, fileData, callback){
$.ajax({
url: config.root + url,
type: "POST",
Function addError
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function addError($rule, $placeholder, $value, $args = []){
if(isset($this->ruleMessages[$rule])){
$this->errors[] = $this->ruleMessages[$rule];
}
- 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 register
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function register($name, $email, $password, $confirmPassword, $captcha){
$isValid = true;
$validation = new Validation();
Function validateData
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
validateData: function (result, targetBlock, errorFunc, errorType, returnVal){
// 1. clear all existing error or success messages
helpers.clearMessages(targetBlock);
Method validate
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validate($data, $skip = false){
$passed = true;
foreach($data as $placeholder => $rules){
Function host
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function host(){
if (!$host = Environment::get('HTTP_HOST')) {
if (!$host = $this->name()) {
$host = Enviroment::get('SERVER_ADDR');
- 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 requestRequired
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function requestRequired(){
foreach (['Post', 'Ajax', 'Get'] as $method) {
$key = 'require' . $method;
if (!empty($this->config[$key])) {
if (in_array($this->request->param('action'), $this->config[$key], true) || $this->config[$key] === ['*']) {
- 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 upload
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static function upload($file, $dir, $id, $type = "file"){
$mimeTypes = self::getAllowedMime($type);
$validation = new Validation();
- 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 getUsers
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getUsers($name = null, $email = null, $role = null, $pageNum = 1){
// validate user inputs
$validation = new Validation();
if(!$validation->validate([
Function send
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
send: function(url, postData, callback, spinnerBlock){
var spinnerEle = null;
$.ajax({
Function updateEmail
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function updateEmail($userId, $emailToken){
if (empty($userId) || empty($emailToken)) {
return false;
}
- 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 startup
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function startup(){
if(!$this->requestRequired()){
return $this->invalidRequest();
}
- 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 triggerComponents
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function triggerComponents(){
// You need to Fire the Components and Controller callbacks in the correct orde
// For example, Authorization depends on form element, so you need to trigger Security first.
Method isCookieValid
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function isCookieValid(){
// "auth" or "remember me" cookie
if(empty($_COOKIE['auth'])) {
return false;
Method isEmailVerificationTokenValid
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function isEmailVerificationTokenValid($userId, $emailToken){
if (empty($userId) || empty($emailToken)) {
return false;
}