for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
class CustomerController extends Controller
{
public function customersLoginAction(Request $request)
$em = $this->getDoctrine()->getManager();
$apiKeyHead = $request->headers->get('API-Key-Token');
$facebookToken = $request->headers->get('social_token');
$apiKey = uniqid('token_');
if ($facebookToken) {
$UserFacebook = $this->get('service_facebook_sdk')->setValue($facebookToken)->getValue();
$userFind = $em->getRepository('AppBundle:Customer')
->findUserByFacebookId($UserFacebook - getId());
if ($userFind) {
$userFind->setApiKey($apiKey);
$em->flush();
} else {
$userFindApiKey = $em->getRepository('AppBundle:Customer')
->findUsernameByApiKey($apiKeyHead);
$userFindApiKey->setEmail($UserFacebook->getEmail());
getEmail
$UserFacebook
integer|double
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.
$userFindApiKey->setFacebookID($UserFacebook->getId());
getId
}
else
This check looks for the else branches of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.
if
These else branches can be removed.
if (rand(1, 6) > 3) { print "Check failed"; } else { //print "Check succeeded"; }
could be turned into
if (rand(1, 6) > 3) { print "Check failed"; }
This is much more concise to read.
//add first, last name or refreshAll
return $this->render(':default:login.html.twig');
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.