@@ -491,33 +491,28 @@ public function __get($property)
491491 // logic will change with it.
492492 $ isUnprefixedVar = in_array ($ property , array_keys ($ this ->unPrefixedVariablesRuntime ));
493493
494- if ($ this ->inBuild () && $ isRuntimeVar ) {
495- throw new BuildTimeVariableAccessException (sprintf ('The %s variable is not available during build time. ' , $ property ));
496- }
497494
498495 if ($ isBuildVar ) {
499496 $ value = $ this ->getValue ($ this ->directVariables [$ property ]);
500- if (is_null ($ value )) {
501- throw new NotValidPlatformException (sprintf ('The %s variable is not defined. Are you sure you \'re running on Platform.sh? ' , $ property ));
502- }
503- return $ value ;
504497 }
505- if ($ isUnprefixedVar ) {
498+ else if ($ isUnprefixedVar ) {
506499 $ value = $ this ->environmentVariables [$ this ->unPrefixedVariablesRuntime [$ property ]] ?? null ;
507- if (is_null ($ value )) {
508- throw new NotValidPlatformException (sprintf ('The %s variable is not defined. Are you sure you \'re running on Platform.sh? ' , $ property ));
509- }
510- return $ value ;
511500 }
512- if ($ isRuntimeVar ) {
501+ else if ($ isRuntimeVar ) {
513502 $ value = $ this ->getValue ($ this ->directVariablesRuntime [$ property ]);
514- if (is_null ($ value )) {
515- throw new NotValidPlatformException (sprintf ('The %s variable is not defined. Are you sure you \'re running on Platform.sh? ' , $ property ));
503+ }
504+ else {
505+ throw new \InvalidArgumentException (sprintf ('No such variable defined: %s ' , $ property ));
506+ }
507+
508+ if (is_null ($ value )) {
509+ if ($ this ->inBuild () && ($ isRuntimeVar || $ isUnprefixedVar )) {
510+ throw new BuildTimeVariableAccessException (sprintf ('The %s variable is not available during build time. ' , $ property ));
516511 }
517- return $ value ;
512+ throw new NotValidPlatformException ( sprintf ( ' The %s variable is not defined. Are you sure you \' re running on Platform.sh? ' , $ property )) ;
518513 }
519514
520- throw new \ InvalidArgumentException ( sprintf ( ' No such variable defined: %s ' , $ property )) ;
515+ return $ value ;
521516 }
522517
523518 /**
@@ -531,21 +526,7 @@ public function __get($property)
531526 */
532527 public function __isset ($ property )
533528 {
534- $ isBuildVar = in_array ($ property , array_keys ($ this ->directVariables ));
535- $ isRuntimeVar = in_array ($ property , array_keys ($ this ->directVariablesRuntime ));
536- // For now, all unprefixed variables are also runtime variables. If that ever changes this
537- // logic will change with it.
538- $ isUnprefixedVar = in_array ($ property , array_keys ($ this ->unPrefixedVariablesRuntime ));
539-
540- if ($ this ->inBuild ()) {
541- return $ isBuildVar && !is_null ($ this ->$ property );
542- }
543-
544- if ($ isBuildVar || $ isRuntimeVar || $ isUnprefixedVar ) {
545- return !is_null ($ this ->$ property );
546- }
547-
548- return false ;
529+ return !is_null ($ this ->$ property );
549530 }
550531
551532 /**
0 commit comments