Completed
Push — master ( 850169...6f6518 )
by Lukas
43:58 queued 29:47
created

DeprecationCheck::getLocalMethods()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 69
Code Lines 55

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 55
nc 1
nop 0
dl 0
loc 69
rs 9.2083
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 * @copyright Copyright (c) 2016, ownCloud, Inc.
4
 *
5
 * @author Joas Schilling <[email protected]>
6
 *
7
 * @license AGPL-3.0
8
 *
9
 * This code is free software: you can redistribute it and/or modify
10
 * it under the terms of the GNU Affero General Public License, version 3,
11
 * as published by the Free Software Foundation.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
 * GNU Affero General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU Affero General Public License, version 3,
19
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
20
 *
21
 */
22
23
namespace OC\App\CodeChecker;
24
25
class DeprecationCheck extends AbstractCheck implements ICheck {
26
	/**
27
	 * @return string
28
	 */
29
	protected function getLocalDescription() {
30
		return 'deprecated';
31
	}
32
33
	/**
34
	 * @return array E.g.: `'ClassName' => 'oc version',`
35
	 */
36
	protected function getLocalClasses() {
37
		return [
38
			'OC_JSON' => '8.2.0',
39
40
			'OCP\Config' => '8.0.0',
41
			'OCP\Contacts' => '8.1.0',
42
			'OCP\DB' => '8.1.0',
43
			'OCP\IHelper' => '8.1.0',
44
			'OCP\JSON' => '8.1.0',
45
			'OCP\Response' => '8.1.0',
46
			'OCP\AppFramework\IApi' => '8.0.0',
47
		];
48
	}
49
50
	/**
51
	 * @return array E.g.: `'ClassName::CONSTANT_NAME' => 'oc version',`
52
	 */
53
	protected function getLocalConstants() {
54
		return [
55
			'OC_API::GUEST_AUTH' => '8.2.0',
56
			'OC_API::USER_AUTH' => '8.2.0',
57
			'OC_API::SUBADMIN_AUTH' => '8.2.0',
58
			'OC_API::ADMIN_AUTH' => '8.2.0',
59
			'OC_API::RESPOND_UNAUTHORISED' => '8.2.0',
60
			'OC_API::RESPOND_SERVER_ERROR' => '8.2.0',
61
			'OC_API::RESPOND_NOT_FOUND' => '8.2.0',
62
			'OC_API::RESPOND_UNKNOWN_ERROR' => '8.2.0',
63
64
			'OCP::PERMISSION_CREATE' => '8.0.0',
65
			'OCP::PERMISSION_READ' => '8.0.0',
66
			'OCP::PERMISSION_UPDATE' => '8.0.0',
67
			'OCP::PERMISSION_DELETE' => '8.0.0',
68
			'OCP::PERMISSION_SHARE' => '8.0.0',
69
			'OCP::PERMISSION_ALL' => '8.0.0',
70
			'OCP::FILENAME_INVALID_CHARS' => '8.0.0',
71
		];
72
	}
73
74
	/**
75
	 * @return array E.g.: `'functionName' => 'oc version',`
76
	 */
77
	protected function getLocalFunctions() {
78
		return [
79
			'OCP::image_path' => '8.0.0',
80
			'OCP::mimetype_icon' => '8.0.0',
81
			'OCP::preview_icon' => '8.0.0',
82
			'OCP::publicPreview_icon' => '8.0.0',
83
			'OCP::human_file_size' => '8.0.0',
84
			'OCP::relative_modified_date' => '8.0.0',
85
			'OCP::simple_file_size' => '8.0.0',
86
			'OCP::html_select_options' => '8.0.0',
87
		];
88
	}
89
90
	/**
91
	 * @return array E.g.: `'ClassName::methodName' => 'oc version',`
92
	 */
93
	protected function getLocalMethods() {
94
		return [
95
			'OC_L10N::get' => '8.2.0',
96
97
			'OCP\Activity\IManager::publishActivity' => '8.2.0',
98
99
			'OCP\App::register' => '8.1.0',
100
			'OCP\App::addNavigationEntry' => '8.1.0',
101
			'OCP\App::getActiveNavigationEntry' => '8.2.0',
102
			'OCP\App::setActiveNavigationEntry' => '8.1.0',
103
104
			'OCP\AppFramework\Controller::params' => '7.0.0',
105
			'OCP\AppFramework\Controller::getParams' => '7.0.0',
106
			'OCP\AppFramework\Controller::method' => '7.0.0',
107
			'OCP\AppFramework\Controller::getUploadedFile' => '7.0.0',
108
			'OCP\AppFramework\Controller::env' => '7.0.0',
109
			'OCP\AppFramework\Controller::cookie' => '7.0.0',
110
			'OCP\AppFramework\Controller::render' => '7.0.0',
111
112
			'OCP\AppFramework\IAppContainer::getCoreApi' => '8.0.0',
113
			'OCP\AppFramework\IAppContainer::isLoggedIn' => '8.0.0',
114
			'OCP\AppFramework\IAppContainer::isAdminUser' => '8.0.0',
115
			'OCP\AppFramework\IAppContainer::log' => '8.0.0',
116
117
			'OCP\BackgroundJob::registerJob' => '8.1.0',
118
119
			'OCP\Files::tmpFile' => '8.1.0',
120
			'OCP\Files::tmpFolder' => '8.1.0',
121
122
			'OCP\IAppConfig::getValue' => '8.0.0',
123
			'OCP\IAppConfig::deleteKey' => '8.0.0',
124
			'OCP\IAppConfig::getKeys' => '8.0.0',
125
			'OCP\IAppConfig::setValue' => '8.0.0',
126
			'OCP\IAppConfig::deleteApp' => '8.0.0',
127
128
			'OCP\IDBConnection::createQueryBuilder' => '8.2.0',
129
			'OCP\IDBConnection::getExpressionBuilder' => '8.2.0',
130
131
			'OCP\ISearch::search' => '8.0.0',
132
133
			'OCP\IServerContainer::getCache' => '8.2.0',
134
			'OCP\IServerContainer::getDb' => '8.1.0',
135
			'OCP\IServerContainer::getHTTPHelper' => '8.1.0',
136
137
			'OCP\User::getUser' => '8.0.0',
138
			'OCP\User::getUsers' => '8.1.0',
139
			'OCP\User::getDisplayName' => '8.1.0',
140
			'OCP\User::getDisplayNames' => '8.1.0',
141
			'OCP\User::userExists' => '8.1.0',
142
			'OCP\User::logout' => '8.1.0',
143
			'OCP\User::checkPassword' => '8.1.0',
144
145
			'OCP\Util::encryptedFiles' => '8.1.0',
146
			'OCP\Util::formatDate' => '8.0.0',
147
			'OCP\Util::generateRandomBytes' => '8.1.0',
148
			'OCP\Util::getServerHost' => '8.1.0',
149
			'OCP\Util::getServerProtocol' => '8.1.0',
150
			'OCP\Util::getRequestUri' => '8.1.0',
151
			'OCP\Util::getScriptName' => '8.1.0',
152
			'OCP\Util::imagePath' => '8.1.0',
153
			'OCP\Util::isValidFileName' => '8.1.0',
154
			'OCP\Util::linkToRoute' => '8.1.0',
155
			'OCP\Util::linkTo' => '8.1.0',
156
			'OCP\Util::logException' => '8.2.0',
157
			'OCP\Util::mb_str_replace' => '8.2.0',
158
			'OCP\Util::mb_substr_replace' => '8.2.0',
159
			'OCP\Util::sendMail' => '8.1.0',
160
		];
161
	}
162
}
163