public static function getIPPReferenceTypeBasedOnArray($data){
      $trimedDataArray = FacadeHelper::trimSpacesForArrayKeys($data);
      if(is_object($trimedDataArray)){
           if($trimedDataArray instanceof IPPReferenceType){
               return $trimedDataArray;
           }else{
               throw new \Exception("The assigned obj to IPPReferenceType is not matched with IPPReferenceType.");
           }
      }
      //THe ReferenceDataType should only contain at most Two elements
      if(is_array($trimedDataArray)){
        if(sizeof($trimedDataArray) >= 3){
          throw new \Exception("Trying to construct IPPReferenceType based on Array. The array should contain at most two fields. name and value");
        }

        $IPPReferenceType = new IPPReferenceType();
        if(isset($trimedDataArray['value']) || isset($trimedDataArray['Value']) ) {
            $val = isset($trimedDataArray['value']) ? $trimedDataArray['value'] : $trimedDataArray['Value'];
            $IPPReferenceType->value = $val;
        }else{
            throw new \Exception("Passed array has no key for 'Value' when contructing an ReferenceType");
        }

        if(isset($trimedDataArray['name']) || isset($trimedDataArray['Name']) ){
           $nam = isset($trimedDataArray['name']) ? $trimedDataArray['name'] : $trimedDataArray['Name'];
           $IPPReferenceType->name = $nam;
         }
        return $IPPReferenceType;
      }else if(is_numeric($trimedDataArray) || is_string($trimedDataArray)){
        $IPPReferenceType = new IPPReferenceType();
        $IPPReferenceType->value = $trimedDataArray;
        return $IPPReferenceType;
      }else{
        throw new \Exception("Can't convert Passed Parameter to IPPReferenceType.");
      }
  }
public static function getIPPReferenceTypeBasedOnArray($data){
      $trimedDataArray = FacadeHelper::trimSpacesForArrayKeys($data);
      if(is_object($trimedDataArray)){
           if($trimedDataArray instanceof IPPReferenceType){
               return $trimedDataArray;
           }else{
               throw new \Exception("The assigned obj to IPPReferenceType is not matched with IPPReferenceType.");
           }
      }
      //THe ReferenceDataType should only contain at most Two elements
      if(is_array($trimedDataArray)){
        if(sizeof($trimedDataArray) >= 3){
          throw new \Exception("Trying to construct IPPReferenceType based on Array. The array should contain at most two fields. name and value");
        }

        $IPPReferenceType = new IPPReferenceType();
        if(isset($trimedDataArray['value']) || isset($trimedDataArray['Value']) ) {
            $val = isset($trimedDataArray['value']) ? $trimedDataArray['value'] : $trimedDataArray['Value'];
            $IPPReferenceType->value = $val;
        }else{
            throw new \Exception("Passed array has no key for 'Value' when contructing an ReferenceType");
        }

        if(isset($trimedDataArray['name']) || isset($trimedDataArray['Name']) ){
           $nam = isset($trimedDataArray['name']) ? $trimedDataArray['name'] : $trimedDataArray['Name'];
           $IPPReferenceType->name = $nam;
         }
        return $IPPReferenceType;
      }else if(is_numeric($trimedDataArray) || is_string($trimedDataArray)){
        $IPPReferenceType = new IPPReferenceType();
        $IPPReferenceType->value = $trimedDataArray;
        return $IPPReferenceType;
      }else{
        throw new \Exception("Can't convert Passed Parameter to IPPReferenceType.");
      }
  }
public static function getIPPReferenceTypeBasedOnArray ( $ data ) { $ trimedDataArray = FacadeHelper :: trimSpacesForArrayKeys ( $ data ) ; if ( is_object ( $ trimedDataArray ) ) { if ( $ trimedDataArray instanceof IPPReferenceType ) { return $ trimedDataArray ; } else { throw new \ Exception ( "The assigned obj to IPPReferenceType is not matched with IPPReferenceType." ) ; } } //THe ReferenceDataType should only contain at most Two elements if ( is_array ( $ trimedDataArray ) ) { if ( sizeof ( $ trimedDataArray ) >= 3 ) { throw new \ Exception ( "Trying to construct IPPReferenceType based on Array. The array should contain at most two fields. name and value" ) ; } $ IPPReferenceType = new IPPReferenceType ( ) ; if ( isset ( $ trimedDataArray [ 'value' ] ) || isset ( $ trimedDataArray [ 'Value' ] ) ) { $ val = isset ( $ trimedDataArray [ 'value' ] ) ? $ trimedDataArray [ 'value' ] : $ trimedDataArray [ 'Value' ] ; $ IPPReferenceType -> value = $ val ; } else { throw new \ Exception ( "Passed array has no key for 'Value' when contructing an ReferenceType" ) ; } if ( isset ( $ trimedDataArray [ 'name' ] ) || isset ( $ trimedDataArray [ 'Name' ] ) ) { $ nam = isset ( $ trimedDataArray [ 'name' ] ) ? $ trimedDataArray [ 'name' ] : $ trimedDataArray [ 'Name' ] ; $ IPPReferenceType -> name = $ nam ; } return $ IPPReferenceType ; } else if ( is_numeric ( $ trimedDataArray ) || is_string ( $ trimedDataArray ) ) { $ IPPReferenceType = new IPPReferenceType ( ) ; $ IPPReferenceType -> value = $ trimedDataArray ; return $ IPPReferenceType ; } else { throw new \ Exception ( "Can't convert Passed Parameter to IPPReferenceType." ) ; } }
Construct an IPPReferenceType based on passed Array or String.
If it is passed as an array, handle it.
If it is passed as a String. Construct an array and put the String on the value
If it is passed as an obj, compare it with IPPReferenceType and return the object
@param $data
It can either be an array or a String, or obj
Construct an IPPReferenceType based on passed Array or String . If it is passed as an array handle it . If it is passed as a String . Construct an array and put the String on the value If it is passed as an obj compare it with IPPReferenceType and return the object