GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — develop (#322)
by
unknown
01:57
created

Orgs   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 85
Duplicated Lines 14.12 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 12
loc 85
rs 10
c 0
b 0
f 0
wmc 7
lcom 1
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getList() 12 12 2
A get() 0 10 1
B edit() 0 24 4

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * Part of the Joomla Framework Github Package
4
 *
5
 * @copyright  Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
6
 * @license    GNU General Public License version 2 or later; see LICENSE
7
 */
8
9
namespace Joomla\Github\Package;
10
11
use Joomla\Github\AbstractPackage;
12
13
/**
14
 * GitHub API Activity class for the Joomla Framework.
15
 *
16
 * @since  1.0
17
 *
18
 * @documentation  http://developer.github.com/v3/orgs/
19
 *
20
 * @property-read  Orgs\Hooks    $hooks    GitHub API object for hooks.
21
 * @property-read  Orgs\Members  $members  GitHub API object for members.
22
 * @property-read  Orgs\Teams    $teams    GitHub API object for teams.
23
 */
24
class Orgs extends AbstractPackage
25
{
26
	/**
27
	 * List user organizations.
28
	 *
29
	 * If a user name is given, public and private organizations for the authenticated user will be listed.
30
	 *
31
	 * @param   string  $user  The user name.
32
	 *
33
	 * @return  object
34
	 *
35
	 * @since   1.0
36
	 */
37 View Code Duplication
	public function getList($user = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
38
	{
39
		// Build the request path.
40
		$path = ($user)
41
			? '/users/' . $user . '/orgs'
42
			: '/user/orgs';
43
44
		// Send the request.
45
		return $this->processResponse(
46
			$this->client->get($this->fetchUrl($path))
47
		);
48
	}
49
50
	/**
51
	 * Get an organization.
52
	 *
53
	 * @param   string  $org  The organization name.
54
	 *
55
	 * @return  object
56
	 *
57
	 * @since   1.0
58
	 */
59
	public function get($org)
60
	{
61
		// Build the request path.
62
		$path = '/orgs/' . $org;
63
64
		// Send the request.
65
		return $this->processResponse(
66
			$this->client->get($this->fetchUrl($path))
67
		);
68
	}
69
70
	/**
71
	 * Edit an organization.
72
	 *
73
	 * @param   string  $org           The organization name.
74
	 * @param   string  $billingEmail  Billing email address. This address is not publicized.
75
	 * @param   string  $company       The company name.
76
	 * @param   string  $email         The email address.
77
	 * @param   string  $location      The location name.
78
	 * @param   string  $name          The name.
79
	 *
80
	 * @return  object
81
	 *
82
	 * @since   1.0
83
	 */
84
	public function edit($org, $billingEmail = '', $company = '', $email = '', $location = '', $name = '')
0 ignored issues
show
Unused Code introduced by
The parameter $billingEmail is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $company is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $email is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $location is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $name is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
85
	{
86
		// Build the request path.
87
		$path = '/orgs/' . $org;
88
89
		$args = array('billing_email', 'company', 'email', 'location', 'name');
90
91
		$data = array();
92
93
		$fArgs = func_get_args();
94
95
		foreach ($args as $i => $arg)
96
		{
97
			if (array_key_exists($i + 1, $fArgs) && $fArgs[$i + 1])
98
			{
99
				$data[$arg] = $fArgs[$i + 1];
100
			}
101
		}
102
103
		// Send the request.
104
		return $this->processResponse(
105
			$this->client->patch($this->fetchUrl($path), $data)
106
		);
107
	}
108
}
109