src/SecucardConnect/Util/MapperUtil.php
public static function map($json, $class, LoggerInterface $logger = null)
    {
        $mapper = new JsonMapper();

        // FIX optional parameters can be null (no phpdoc NULL tag needed)
        $mapper->bStrictNullTypes = false;

        if (!is_object($json)) {
            // must set when json is assoc array
            $mapper->bEnforceMapType = false;
        }
        if (!empty($logger)) {
            $mapper->setLogger($logger);
        }
        return $mapper->map($json, new $class());
    }
public static function map($json, $class, LoggerInterface $logger = null)
    {
        $mapper = new JsonMapper();

        // FIX optional parameters can be null (no phpdoc NULL tag needed)
        $mapper->bStrictNullTypes = false;

        if (!is_object($json)) {
            // must set when json is assoc array
            $mapper->bEnforceMapType = false;
        }
        if (!empty($logger)) {
            $mapper->setLogger($logger);
        }
        return $mapper->map($json, new $class());
    }
public static function map ( $ json , $ class , LoggerInterface $ logger = null ) { $ mapper = new JsonMapper ( ) ; // FIX optional parameters can be null (no phpdoc NULL tag needed) $ mapper -> bStrictNullTypes = false ; if ( ! is_object ( $ json ) ) { // must set when json is assoc array $ mapper -> bEnforceMapType = false ; } if ( ! empty ( $ logger ) ) { $ mapper -> setLogger ( $ logger ) ; } return $ mapper -> map ( $ json , new $ class ( ) ) ; }
Mapping JSON string to a instance of a given class.
@param array | object $json The JSON to map, either an assoc. array or object (stdClass), never a string.
@param string $class The full qualified name of the class to map to.
@param LoggerInterface|null $logger
@return mixed The created instance, never null-
@throws \Exception If the mapping could not completed.
Mapping JSON string to a instance of a given class .