PluginProbe
TablePress – Tables in WordPress made easy / 3.4
TablePress – Tables in WordPress made easy v3.4
3.4 3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 All 45 releases
tablepress / libraries / vendor / PhpSpreadsheet / Calculation / TextData / CaseConvert.php

CaseConvert.php in TablePress – Tables in WordPress made easy 3.4, at libraries/vendor/PhpSpreadsheet/Calculation/TextData/CaseConvert.php

91 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace TablePress\PhpOffice\PhpSpreadsheet\Calculation\TextData;
4
5 use TablePress\PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled;
6 use TablePress\PhpOffice\PhpSpreadsheet\Calculation\Exception as CalcExp;
7 use TablePress\PhpOffice\PhpSpreadsheet\Shared\StringHelper;
8
9 class CaseConvert
10 {
11 use ArrayEnabled;
12
13 /**
14 * LOWERCASE.
15 *
16 * Converts a string value to upper case.
17 *
18 * @param mixed $mixedCaseValue The string value to convert to lower case
19 * Or can be an array of values
20 *
21 * @return array<mixed>|string If an array of values is passed as the argument, then the returned result will also be an array
22 * with the same dimensions
23 */
24 public static function lower($mixedCaseValue)
25 {
26 if (is_array($mixedCaseValue)) {
27 return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $mixedCaseValue);
28 }
29
30 try {
31 $mixedCaseValue = Helpers::extractString($mixedCaseValue, true);
32 } catch (CalcExp $e) {
33 return $e->getMessage();
34 }
35
36 return StringHelper::strToLower($mixedCaseValue);
37 }
38
39 /**
40 * UPPERCASE.
41 *
42 * Converts a string value to upper case.
43 *
44 * @param mixed $mixedCaseValue The string value to convert to upper case
45 * Or can be an array of values
46 *
47 * @return array<mixed>|string If an array of values is passed as the argument, then the returned result will also be an array
48 * with the same dimensions
49 */
50 public static function upper($mixedCaseValue)
51 {
52 if (is_array($mixedCaseValue)) {
53 return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $mixedCaseValue);
54 }
55
56 try {
57 $mixedCaseValue = Helpers::extractString($mixedCaseValue, true);
58 } catch (CalcExp $e) {
59 return $e->getMessage();
60 }
61
62 return StringHelper::strToUpper($mixedCaseValue);
63 }
64
65 /**
66 * PROPERCASE.
67 *
68 * Converts a string value to proper or title case.
69 *
70 * @param mixed $mixedCaseValue The string value to convert to title case
71 * Or can be an array of values
72 *
73 * @return array<mixed>|string If an array of values is passed as the argument, then the returned result will also be an array
74 * with the same dimensions
75 */
76 public static function proper($mixedCaseValue)
77 {
78 if (is_array($mixedCaseValue)) {
79 return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $mixedCaseValue);
80 }
81
82 try {
83 $mixedCaseValue = Helpers::extractString($mixedCaseValue, true);
84 } catch (CalcExp $e) {
85 return $e->getMessage();
86 }
87
88 return StringHelper::strToTitle($mixedCaseValue);
89 }
90 }
91