|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace FinanCalc\Constants { |
|
4
|
|
|
|
|
5
|
|
|
use FinanCalc\Utils\Strings; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Class ErrorMessages |
|
9
|
|
|
* @package FinanCalc\Constants |
|
10
|
|
|
*/ |
|
11
|
|
|
class ErrorMessages |
|
12
|
|
|
{ |
|
13
|
|
|
/** |
|
14
|
|
|
* @param $expectedTypeName [Name of the expected class as a string] |
|
15
|
|
|
* @param string $foundTypeName [Name of the class that was used instead] |
|
16
|
|
|
* @return string [Concatenated message as a string] |
|
17
|
|
|
*/ |
|
18
|
|
|
public static function getIncompatibleTypesMessage($expectedTypeName, $foundTypeName) |
|
19
|
|
|
{ |
|
20
|
|
|
return Strings::getFormattedString( |
|
21
|
|
|
'message_incompatible_types', |
|
22
|
|
|
null, |
|
23
|
|
|
$expectedTypeName, |
|
24
|
|
|
$foundTypeName |
|
25
|
|
|
); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* @param $foundValue [Name of the expected value as a string] |
|
30
|
|
|
* @return string [Concatenated message as a string] |
|
31
|
|
|
*/ |
|
32
|
|
|
public static function getMustBePositiveNumberMessage($foundValue) |
|
33
|
|
|
{ |
|
34
|
|
|
return Strings::getFormattedString( |
|
35
|
|
|
'message_must_be_positive_number', |
|
36
|
|
|
null, |
|
37
|
|
|
$foundValue |
|
38
|
|
|
); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @param $foundValue [Name of the expected value as a string] |
|
44
|
|
|
* @return string [Concatenated message as a string] |
|
45
|
|
|
*/ |
|
46
|
|
|
public static function getMustNotBeNegativeNumberMessage($foundValue) |
|
47
|
|
|
{ |
|
48
|
|
|
return Strings::getFormattedString( |
|
49
|
|
|
'message_must_not_be_negative', |
|
50
|
|
|
null, |
|
51
|
|
|
$foundValue |
|
52
|
|
|
); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* @param $configField [Name of the expected value as a string] |
|
57
|
|
|
* @return string [Concatenated message as a string] |
|
58
|
|
|
*/ |
|
59
|
|
|
public static function getConfigFieldNotFoundMessage($configField) |
|
60
|
|
|
{ |
|
61
|
|
|
return Strings::getFormattedString( |
|
62
|
|
|
'message_config_field_not_found', |
|
63
|
|
|
null, |
|
64
|
|
|
$configField |
|
65
|
|
|
); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* @param $propertyName [Name of the property as a string] |
|
70
|
|
|
* @param string $className [Name of the class as a string] |
|
71
|
|
|
* @return string [Concatenated message as a string] |
|
72
|
|
|
*/ |
|
73
|
|
|
public static function getNonExistentPropertyMessage($propertyName, $className) |
|
74
|
|
|
{ |
|
75
|
|
|
return Strings::getFormattedString( |
|
76
|
|
|
'message_nonexistent_property', |
|
77
|
|
|
null, |
|
78
|
|
|
$propertyName, |
|
79
|
|
|
$className |
|
80
|
|
|
); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @param $factoryClassName [Name of the uninitialized factory class as a string] |
|
85
|
|
|
* @return string [Concatenated message as a string] |
|
86
|
|
|
*/ |
|
87
|
|
|
public static function getFactoryClassNotInitializedMessage($factoryClassName) |
|
88
|
|
|
{ |
|
89
|
|
|
return Strings::getFormattedString( |
|
90
|
|
|
'message_factory_class_not_initialized', |
|
91
|
|
|
null, |
|
92
|
|
|
$factoryClassName |
|
93
|
|
|
); |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* @param $factoryClassName [Name of the factory class as a string] |
|
98
|
|
|
* @param $factoriesNamespace [Name of the namespace that the factory class is supposed to be in as a string] |
|
99
|
|
|
* @return string [Concatenated message as a string] |
|
100
|
|
|
*/ |
|
101
|
|
|
public static function getFactoryClassExpectedInNamespaceMessage($factoryClassName, $factoriesNamespace) |
|
102
|
|
|
{ |
|
103
|
|
|
return Strings::getFormattedString( |
|
104
|
|
|
'message_factory_class_expected_in_namespace', |
|
105
|
|
|
null, |
|
106
|
|
|
$factoryClassName, |
|
107
|
|
|
$factoriesNamespace |
|
108
|
|
|
); |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* @param $factoryClassName [Name of the factory class as a string] |
|
113
|
|
|
* @param string $factoryClassAncestorName [Name of the factory class' expected parent class name as a string] |
|
114
|
|
|
* @return string [Concatenated message as a string] |
|
115
|
|
|
*/ |
|
116
|
|
|
public static function getFactoryClassExpectedAncestorMessage($factoryClassName, $factoryClassAncestorName) |
|
117
|
|
|
{ |
|
118
|
|
|
return Strings::getFormattedString( |
|
119
|
|
|
'message_factory_class_expected_ancestor', |
|
120
|
|
|
null, |
|
121
|
|
|
$factoryClassName, |
|
122
|
|
|
$factoryClassAncestorName |
|
123
|
|
|
); |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
/** |
|
127
|
|
|
* @return string [Message as a string] |
|
128
|
|
|
*/ |
|
129
|
|
|
public static function getMustDefineManufacturedClassNameMessage() |
|
130
|
|
|
{ |
|
131
|
|
|
return Strings::getString('message_must_define_manufactured_class_name'); |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
/** |
|
135
|
|
|
* @param $className [Name of the class that has not been defined] |
|
136
|
|
|
* @return string [Concatenated message as a string] |
|
137
|
|
|
*/ |
|
138
|
|
|
public static function getClassNotDefinedMessage($className) |
|
139
|
|
|
{ |
|
140
|
|
|
return Strings::getFormattedString( |
|
141
|
|
|
'message_class_not_defined', |
|
142
|
|
|
null, |
|
143
|
|
|
$className |
|
144
|
|
|
); |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
/** |
|
148
|
|
|
* @return string [Message as a string] |
|
149
|
|
|
*/ |
|
150
|
|
|
public static function getInvalidTypeMessage() |
|
151
|
|
|
{ |
|
152
|
|
|
return Strings::getString('message_invalid_type_specified'); |
|
153
|
|
|
} |
|
154
|
|
|
|
|
155
|
|
|
/** |
|
156
|
|
|
* @return string [Message as a string] |
|
157
|
|
|
*/ |
|
158
|
|
|
public static function getStartDateMustBeBeforeEndDateMessage() |
|
159
|
|
|
{ |
|
160
|
|
|
return Strings::getString('message_start_date_must_be_before_end_date'); |
|
161
|
|
|
} |
|
162
|
|
|
|
|
163
|
|
|
/** |
|
164
|
|
|
* @return string [Message as a string] |
|
165
|
|
|
*/ |
|
166
|
|
|
public static function getDayCountConventionNotDefinedMessage() |
|
167
|
|
|
{ |
|
168
|
|
|
return Strings::getString('message_day_count_convention_not_defined'); |
|
169
|
|
|
} |
|
170
|
|
|
|
|
171
|
|
|
/** |
|
172
|
|
|
* @return string [Message as a string] |
|
173
|
|
|
*/ |
|
174
|
|
|
public static function getPropresultarrayNotSuppliedMessage() |
|
175
|
|
|
{ |
|
176
|
|
|
return Strings::getString('message_propresultarray_not_supplied'); |
|
177
|
|
|
} |
|
178
|
|
|
|
|
179
|
|
|
/** |
|
180
|
|
|
* @param string $methodName [Name of the method] |
|
181
|
|
|
* @param string $className [Name of the class] |
|
182
|
|
|
* @return string [Concatenated message as a string] |
|
183
|
|
|
*/ |
|
184
|
|
|
public static function getMethodDoesNotExistMessage($methodName, $className) |
|
185
|
|
|
{ |
|
186
|
|
|
return Strings::getFormattedString( |
|
187
|
|
|
'message_method_does_not_exist', |
|
188
|
|
|
null, |
|
189
|
|
|
$methodName, |
|
190
|
|
|
$className |
|
191
|
|
|
); |
|
192
|
|
|
} |
|
193
|
|
|
} |
|
194
|
|
|
} |
|
195
|
|
|
|