Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

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.

Quote_Style   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 121
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 67
c 1
b 0
f 0
dl 0
loc 121
ccs 4
cts 4
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A get_styled_quotes() 0 6 2
1
<?php
2
/**
3
 *  This file is part of PHP-Typography.
4
 *
5
 *  Copyright 2017-2019 Peter Putzer.
6
 *
7
 *  This program is free software; you can redistribute it and/or modify
8
 *  it under the terms of the GNU General Public License as published by
9
 *  the Free Software Foundation; either version 2 of the License, or
10
 *  (at your option) any later version.
11
 *
12
 *  This program is distributed in the hope that it will be useful,
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 *  GNU General Public License for more details.
16
 *
17
 *  You should have received a copy of the GNU General Public License along
18
 *  with this program; if not, write to the Free Software Foundation, Inc.,
19
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
 *
21
 *  ***
22
 *
23
 *  @package mundschenk-at/php-typography
24
 *  @license http://www.gnu.org/licenses/gpl-2.0.html
25
 */
26
27
namespace PHP_Typography\Settings;
28
29
use PHP_Typography\Settings;
30
use PHP_Typography\U;
31
32
/**
33
 * A factory class for different quote styles.
34
 *
35
 * @author Peter Putzer <[email protected]>
36
 *
37
 * @since 5.0.0
38
 */
39
abstract class Quote_Style {
40
41
	// Valid quote styles.
42
	const DOUBLE_CURLED              = 'doubleCurled';
43
	const DOUBLE_CURLED_REVERSED     = 'doubleCurledReversed';
44
	const DOUBLE_LOW_9               = 'doubleLow9';
45
	const DOUBLE_LOW_9_REVERSED      = 'doubleLow9Reversed';
46
	const SINGLE_CURLED              = 'singleCurled';
47
	const SINGLE_CURLED_REVERSED     = 'singleCurledReversed';
48
	const SINGLE_LOW_9               = 'singleLow9';
49
	const SINGLE_LOW_9_REVERSED      = 'singleLow9Reversed';
50
	const DOUBLE_GUILLEMETS          = 'doubleGuillemets';
51
	const DOUBLE_GUILLEMETS_REVERSED = 'doubleGuillemetsReversed';
52
	const DOUBLE_GUILLEMETS_FRENCH   = 'doubleGuillemetsFrench';
53
	const SINGLE_GUILLEMETS          = 'singleGuillemets';
54
	const SINGLE_GUILLEMETS_REVERSED = 'singleGuillemetsReversed';
55
	const CORNER_BRACKETS            = 'cornerBrackets';
56
	const WHITE_CORNER_BRACKETS      = 'whiteCornerBracket';
57
58
	/**
59
	 * Available quote styles.
60
	 *
61
	 * @var array
62
	 */
63
	private static $styles = [
64
		self::DOUBLE_CURLED              => [
65
			self::_OPEN  => U::DOUBLE_QUOTE_OPEN,
66
			self::_CLOSE => U::DOUBLE_QUOTE_CLOSE,
67
		],
68
		self::DOUBLE_CURLED_REVERSED     => [
69
			self::_OPEN  => U::DOUBLE_QUOTE_CLOSE,
70
			self::_CLOSE => U::DOUBLE_QUOTE_CLOSE,
71
		],
72
		self::DOUBLE_LOW_9               => [
73
			self::_OPEN  => U::DOUBLE_LOW_9_QUOTE,
74
			self::_CLOSE => U::DOUBLE_QUOTE_CLOSE,
75
		],
76
		self::DOUBLE_LOW_9_REVERSED      => [
77
			self::_OPEN  => U::DOUBLE_LOW_9_QUOTE,
78
			self::_CLOSE => U::DOUBLE_QUOTE_OPEN,
79
		],
80
		self::SINGLE_CURLED              => [
81
			self::_OPEN  => U::SINGLE_QUOTE_OPEN,
82
			self::_CLOSE => U::SINGLE_QUOTE_CLOSE,
83
		],
84
		self::SINGLE_CURLED_REVERSED     => [
85
			self::_OPEN  => U::SINGLE_QUOTE_CLOSE,
86
			self::_CLOSE => U::SINGLE_QUOTE_CLOSE,
87
		],
88
		self::SINGLE_LOW_9               => [
89
			self::_OPEN  => U::SINGLE_LOW_9_QUOTE,
90
			self::_CLOSE => U::SINGLE_QUOTE_CLOSE,
91
		],
92
		self::SINGLE_LOW_9_REVERSED      => [
93
			self::_OPEN  => U::SINGLE_LOW_9_QUOTE,
94
			self::_CLOSE => U::SINGLE_QUOTE_OPEN,
95
		],
96
		self::DOUBLE_GUILLEMETS          => [
97
			self::_OPEN  => U::GUILLEMET_OPEN,
98
			self::_CLOSE => U::GUILLEMET_CLOSE,
99
		],
100
		self::DOUBLE_GUILLEMETS_REVERSED => [
101
			self::_OPEN  => U::GUILLEMET_CLOSE,
102
			self::_CLOSE => U::GUILLEMET_OPEN,
103
		],
104
		self::DOUBLE_GUILLEMETS_FRENCH   => [
105
			self::_OPEN  => U::GUILLEMET_OPEN . U::NO_BREAK_NARROW_SPACE,
106
			self::_CLOSE => U::NO_BREAK_NARROW_SPACE . U::GUILLEMET_CLOSE,
107
		],
108
		self::SINGLE_GUILLEMETS          => [
109
			self::_OPEN  => U::SINGLE_ANGLE_QUOTE_OPEN,
110
			self::_CLOSE => U::SINGLE_ANGLE_QUOTE_CLOSE,
111
		],
112
		self::SINGLE_GUILLEMETS_REVERSED => [
113
			self::_OPEN  => U::SINGLE_ANGLE_QUOTE_CLOSE,
114
			self::_CLOSE => U::SINGLE_ANGLE_QUOTE_OPEN,
115
		],
116
		self::CORNER_BRACKETS            => [
117
			self::_OPEN  => U::LEFT_CORNER_BRACKET,
118
			self::_CLOSE => U::RIGHT_CORNER_BRACKET,
119
		],
120
		self::WHITE_CORNER_BRACKETS      => [
121
			self::_OPEN  => U::LEFT_WHITE_CORNER_BRACKET,
122
			self::_CLOSE => U::RIGHT_WHITE_CORNER_BRACKET,
123
		],
124
	];
125
126
	/**
127
	 * Opening quote.
128
	 *
129
	 * @internal
130
	 *
131
	 * @var int
132
	 */
133
	const _OPEN = 0;
134
135
	/**
136
	 * Closing quote.
137
	 *
138
	 * @internal
139
	 *
140
	 * @var int
141
	 */
142
	const _CLOSE = 1;
143
144
	/**
145
	 * Creates a new Quotes object in the given style.
146
	 *
147
	 * @since 6.5.0 The $settings parameter has been deprecated.
148
	 *
149
	 * @param string   $style    The quote style.
150
	 * @param Settings $settings The current settings.
151
	 *
152
	 * @return Quotes|null Returns null in case of an invalid $style parameter.
153
	 */
154 17
	public static function get_styled_quotes( $style, /** Currently unused. @scrutinizer ignore-unused */ Settings $settings ) {
155 17
		if ( isset( self::$styles[ $style ] ) ) {
156 15
			return new Simple_Quotes( self::$styles[ $style ][ self::_OPEN ], self::$styles[ $style ][ self::_CLOSE ] );
157
		}
158
159 2
		return null;
160
	}
161
}
162