Showing 21 of 23 total issues
User
has 36 functions (exceeds 20 allowed). Consider refactoring. Open
class User
{
protected $id;
protected $email;
protected $roles = [];
Method extract
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function extract(User $object)
{
$data = [
'email' => $object->getEmail(),
'id' => $object->getId(),
Method hydrate
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function hydrate(array $data, User $object)
{
$object->setEmail($data['email']);
$object->setName($data['name']);
$object->setSendNotifications($data['sendNotifications']);
Method buildForm
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildForm(FormBuilderInterface $builder, array $options)
{
$mentorTags = $builder
->create('mentorTags', TextType::class, [
'required' => false,
Method githubAction
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function githubAction(Application $app, Request $request)
{
$clientID = $app['config']['github']['api_key'];
$clientSecret = $app['config']['github']['api_secret'];
$code = $request->query->get('code');
Function hydrate
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function hydrate(array $data, User $object)
{
$object->setEmail($data['email']);
$object->setName($data['name']);
$object->setSendNotifications($data['sendNotifications']);
- 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 githubAction
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function githubAction(Application $app, Request $request)
{
$clientID = $app['config']['github']['api_key'];
$clientSecret = $app['config']['github']['api_secret'];
$code = $request->query->get('code');
- 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 testSettersAndGetters
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testSettersAndGetters()
{
$testData = [
'email' => 'test@test.com',
'githubUid' => '1234',
Method execute
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln('Starting to fetch github-Usernames');
$data = parse_ini_file(__DIR__ . '/../../../.env');
$pdo = new \PDO(
Method up
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function up()
{
$taxonomyVocabulary = $this->table('taxonomyVocabulary');
$taxonomyVocabulary
->addColumn('name', 'string')
Method save
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function save(Conversation $conversation)
{
$convo_data = [
'id' => $conversation->getId(),
'from_user_id' => $conversation->getFromUser()->getId(),
Method hydrateConversation
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function hydrateConversation(array $convo_data)
{
$messages_data = $this->dbal->fetchAll(
'SELECT * FROM messages WHERE conversation_id = :conversation_id',
['conversation_id' => $convo_data['id']]
Method getTerms
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getTerms(Application $app, $vocabularyName, $termName = null)
{
/** @var \Mentoring\Taxonomy\TaxonomyService $taxonomyService */
$taxonomyService = $app['taxonomy.service'];
try {
Method register
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function register(Container $app)
{
$app['conversation_repository'] = function (Application $app) {
return new ConversationRepository($app['db'], $app['user.manager']);
};
Function extract
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function extract(User $object)
{
$data = [
'email' => $object->getEmail(),
'id' => $object->getId(),
- 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 startNew
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function startNew(User $fromUser, User $toUser, $subject, $opening_body, \DateTime $created_at = null)
Avoid too many return
statements within this method. Open
return $types;
Avoid too many return
statements within this method. Open
return new AuthController();
Avoid too many return
statements within this method. Open
return new ConversationReplyForm();
Function save
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function save(Conversation $conversation)
{
$convo_data = [
'id' => $conversation->getId(),
'from_user_id' => $conversation->getFromUser()->getId(),
- 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"