88 * For the full copyright and license information, please view the LICENSE
99 * file that was distributed with this source code.
1010 */
11+
1112namespace NilPortugues \Api \Mapping ;
1213
1314use NilPortugues \Api \Mappings \ApiMapping ;
@@ -50,14 +51,14 @@ public static function fromClass($className)
5051 $ className = '\\' .ltrim ($ className , '\\' );
5152 if (!class_exists ($ className , true )) {
5253 throw new MappingException (
53- sprintf ('Provided class %s could not be loaded. ' , $ className )
54+ \ sprintf ('Provided class %s could not be loaded. ' , $ className )
5455 );
5556 }
5657 $ instance = new $ className ();
5758
58- if (!in_array (ApiMapping::class, class_implements ($ instance , true ))) {
59+ if (!in_array (ApiMapping::class, \ class_implements ($ instance , true ))) {
5960 throw new MappingException (
60- sprintf ('Class %s must implement %s. ' , ltrim ($ className , '\\' ), ApiMapping::class)
61+ \ sprintf ('Class %s must implement %s. ' , \ ltrim ($ className , '\\' ), ApiMapping::class)
6162 );
6263 }
6364
@@ -70,11 +71,11 @@ public static function fromClass($className)
7071 static ::URLS_KEY => $ instance ->getUrls (),
7172 ];
7273
73- if (in_array (HalJsonMapping::class, class_implements ($ instance , true ))) {
74+ if (\ in_array (HalJsonMapping::class, \ class_implements ($ instance , true ))) {
7475 $ mappedClass [static ::CURIES_KEY ] = $ instance ->getCuries ();
7576 }
7677
77- if (in_array (JsonApiMapping::class, class_implements ($ instance , true ))) {
78+ if (\ in_array (JsonApiMapping::class, \ class_implements ($ instance , true ))) {
7879 $ mappedClass [static ::RELATIONSHIPS_KEY ] = $ instance ->getRelationships ();
7980 }
8081
@@ -167,10 +168,10 @@ protected static function setAliasedProperties(array &$mappedClass, Mapping $map
167168 {
168169 if (false === empty ($ mappedClass [static ::ALIASED_PROPERTIES_KEY ])) {
169170 $ mapping ->setPropertyNameAliases ($ mappedClass [static ::ALIASED_PROPERTIES_KEY ]);
170- foreach (array_keys ($ mapping ->getAliasedProperties ()) as $ propertyName ) {
171- if (false === in_array ($ propertyName , static ::getClassProperties ($ className ), true )) {
171+ foreach (\ array_keys ($ mapping ->getAliasedProperties ()) as $ propertyName ) {
172+ if (false === \ in_array ($ propertyName , static ::getClassProperties ($ className ), true )) {
172173 throw new MappingException (
173- sprintf (
174+ \ sprintf (
174175 'Could not alias property %s in class %s because it does not exist. ' ,
175176 $ propertyName ,
176177 $ className
@@ -203,11 +204,11 @@ protected static function getClassProperties($className)
203204
204205 if ($ parentClass = $ ref ->getParentClass ()) {
205206 $ parentPropsArr = static ::getClassProperties ($ parentClass ->getName ());
206- if (count ($ parentPropsArr ) > 0 ) {
207- $ properties = array_merge ($ parentPropsArr , $ properties );
207+ if (\ count ($ parentPropsArr ) > 0 ) {
208+ $ properties = \ array_merge ($ parentPropsArr , $ properties );
208209 }
209210 }
210- static ::$ classProperties [$ className ] = array_keys ($ properties );
211+ static ::$ classProperties [$ className ] = \ array_keys ($ properties );
211212 }
212213
213214 return static ::$ classProperties [$ className ];
@@ -225,9 +226,9 @@ protected static function setHideProperties(array &$mappedClass, Mapping $mappin
225226 if (false === empty ($ mappedClass [static ::HIDE_PROPERTIES_KEY ])) {
226227 $ mapping ->setHiddenProperties ($ mappedClass [static ::HIDE_PROPERTIES_KEY ]);
227228 foreach ($ mapping ->getHiddenProperties () as $ propertyName ) {
228- if (false === in_array ($ propertyName , static ::getClassProperties ($ className ), true )) {
229+ if (false === \ in_array ($ propertyName , static ::getClassProperties ($ className ), true )) {
229230 throw new MappingException (
230- sprintf (
231+ \ sprintf (
231232 'Could not hide property %s in class %s because it does not exist. ' ,
232233 $ propertyName ,
233234 $ className
@@ -249,9 +250,9 @@ protected static function setRelationships(array &$mappedClass, Mapping $mapping
249250 {
250251 if (!empty ($ mappedClass [static ::RELATIONSHIPS_KEY ])) {
251252 foreach ($ mappedClass [static ::RELATIONSHIPS_KEY ] as $ propertyName => $ urls ) {
252- if (false === in_array ($ propertyName , static ::getClassProperties ($ className ))) {
253+ if (false === \ in_array ($ propertyName , static ::getClassProperties ($ className ))) {
253254 throw new MappingException (
254- sprintf (
255+ \ sprintf (
255256 'Could not find property %s in class %s because it does not exist. ' ,
256257 $ propertyName ,
257258 $ className
0 commit comments