Skip to main content
Rollback to Revision 4
Source Link
Mast
  • 13.9k
  • 12
  • 57
  • 128

Some addtional comments based on your updated question. This is in addition to the items listed above.

Consistent parameter typing

If you are going to use parameter typing, use it consistently. You use parameter typing in your systemUserLogin::constructor but you don't use it in systemUserAuthenticator::systemUserLoginValidation().

Scalar parameter types should be lowercase

In PHP you use string not String

Class name should start with a capital letter

PSR-1 coding standards state that class names should start with a capital letter

systemUserLogin should be SystemUserLogin, etc.

Always use curly braces for control structures

Although it is perfectly valid syntax to omit curly braces when a control structure only contains one line of code. But it is a best practice to always use them as they make the code more rreadable and prevent future errors. Future you or another developer may want to add a line to a control block and introduce a hard to find bug because they didn't realize the curly braces weren't there.

  if ($userData) {
      return $userData;
  } 
  else {
      return false;
  }

Or here you could just use the ternary control structure:

  return ($userData) ? $userData : false;

You should be taking parameter tpying further and use return type declarations as well.

PHP now offers return type declartions so you can enforce the type being returned by your code.


Some addtional comments based on your updated question. This is in addition to the items listed above.

Consistent parameter typing

If you are going to use parameter typing, use it consistently. You use parameter typing in your systemUserLogin::constructor but you don't use it in systemUserAuthenticator::systemUserLoginValidation().

Scalar parameter types should be lowercase

In PHP you use string not String

Class name should start with a capital letter

PSR-1 coding standards state that class names should start with a capital letter

systemUserLogin should be SystemUserLogin, etc.

Always use curly braces for control structures

Although it is perfectly valid syntax to omit curly braces when a control structure only contains one line of code. But it is a best practice to always use them as they make the code more rreadable and prevent future errors. Future you or another developer may want to add a line to a control block and introduce a hard to find bug because they didn't realize the curly braces weren't there.

  if ($userData) {
      return $userData;
  } 
  else {
      return false;
  }

Or here you could just use the ternary control structure:

  return ($userData) ? $userData : false;

You should be taking parameter tpying further and use return type declarations as well.

PHP now offers return type declartions so you can enforce the type being returned by your code.

added 1403 characters in body
Source Link
John Conde
  • 496
  • 1
  • 5
  • 11

Some addtional comments based on your updated question. This is in addition to the items listed above.

Consistent parameter typing

If you are going to use parameter typing, use it consistently. You use parameter typing in your systemUserLogin::constructor but you don't use it in systemUserAuthenticator::systemUserLoginValidation().

Scalar parameter types should be lowercase

In PHP you use string not String

Class name should start with a capital letter

PSR-1 coding standards state that class names should start with a capital letter

systemUserLogin should be SystemUserLogin, etc.

Always use curly braces for control structures

Although it is perfectly valid syntax to omit curly braces when a control structure only contains one line of code. But it is a best practice to always use them as they make the code more rreadable and prevent future errors. Future you or another developer may want to add a line to a control block and introduce a hard to find bug because they didn't realize the curly braces weren't there.

  if ($userData) {
      return $userData;
  } 
  else {
      return false;
  }

Or here you could just use the ternary control structure:

  return ($userData) ? $userData : false;

You should be taking parameter tpying further and use return type declarations as well.

PHP now offers return type declartions so you can enforce the type being returned by your code.


Some addtional comments based on your updated question. This is in addition to the items listed above.

Consistent parameter typing

If you are going to use parameter typing, use it consistently. You use parameter typing in your systemUserLogin::constructor but you don't use it in systemUserAuthenticator::systemUserLoginValidation().

Scalar parameter types should be lowercase

In PHP you use string not String

Class name should start with a capital letter

PSR-1 coding standards state that class names should start with a capital letter

systemUserLogin should be SystemUserLogin, etc.

Always use curly braces for control structures

Although it is perfectly valid syntax to omit curly braces when a control structure only contains one line of code. But it is a best practice to always use them as they make the code more rreadable and prevent future errors. Future you or another developer may want to add a line to a control block and introduce a hard to find bug because they didn't realize the curly braces weren't there.

  if ($userData) {
      return $userData;
  } 
  else {
      return false;
  }

Or here you could just use the ternary control structure:

  return ($userData) ? $userData : false;

You should be taking parameter tpying further and use return type declarations as well.

PHP now offers return type declartions so you can enforce the type being returned by your code.

added 144 characters in body
Source Link
John Conde
  • 496
  • 1
  • 5
  • 11

PSR-2 coding standardsPSR-2 coding standards say there should be a line between the namespace declaration and your use statements.

ClasClass names should be camel case

The PSR-2 standards say class names should be camel casePSR-1 standards say class names should be camel case and should not use underscores:

Besides the fact that they aren't technically variables but "class members", convention says they go at the top of the class so it is already clear what they are. No need to add unnecessary comments pointing out the obvious. Save your comments for anything that might be ambiguous or needs explanation because it isn't clear from reading the code.

Don't mix coding styles

Your class properties you use both underscores and camel case in your names. Use one or the other but not both.

PSR-2 coding standards say there should be a line between the namespace declaration and your use statements.

Clas names should be camel case

The PSR-2 standards say class names should be camel case and should not use underscores:

Besides the fact that they aren't technically variables but "class members", convention says they go at the top of the class so it is already clear what they are. No need to add unnecessary comments pointing out the obvious. Save your comments for anything that might be ambiguous or needs explanation because it isn't clear from reading the code.

PSR-2 coding standards say there should be a line between the namespace declaration and your use statements.

Class names should be camel case

The PSR-1 standards say class names should be camel case and should not use underscores:

Besides the fact that they aren't technically variables but "class members", convention says they go at the top of the class so it is already clear what they are. No need to add unnecessary comments pointing out the obvious. Save your comments for anything that might be ambiguous or needs explanation because it isn't clear from reading the code.

Don't mix coding styles

Your class properties you use both underscores and camel case in your names. Use one or the other but not both.

added 155 characters in body
Source Link
John Conde
  • 496
  • 1
  • 5
  • 11
Loading
added 548 characters in body
Source Link
John Conde
  • 496
  • 1
  • 5
  • 11
Loading
Source Link
John Conde
  • 496
  • 1
  • 5
  • 11
Loading