src/wcmf/lib/persistence/ObjectId.php
public static function parse($oid) {
    // fast checks first
    if ($oid instanceof ObjectId) {
      return $oid;
    }

    $oidParts = self::parseOidString($oid);
    $type = $oidParts['type'];
    $ids = $oidParts['id'];
    $prefix = $oidParts['prefix'];

    // check the type
    if (!ObjectFactory::getInstance('persistenceFacade')->isKnownType($type)) {
      return null;
    }

    // check if number of ids match the type
    $numPks = self::getNumberOfPKs($type);
    if ($numPks == null || $numPks != sizeof($ids)) {
      return null;
    }

    return new ObjectID($type, $ids, $prefix);
  }
public static function parse($oid) {
    // fast checks first
    if ($oid instanceof ObjectId) {
      return $oid;
    }

    $oidParts = self::parseOidString($oid);
    $type = $oidParts['type'];
    $ids = $oidParts['id'];
    $prefix = $oidParts['prefix'];

    // check the type
    if (!ObjectFactory::getInstance('persistenceFacade')->isKnownType($type)) {
      return null;
    }

    // check if number of ids match the type
    $numPks = self::getNumberOfPKs($type);
    if ($numPks == null || $numPks != sizeof($ids)) {
      return null;
    }

    return new ObjectID($type, $ids, $prefix);
  }
public static function parse ( $ oid ) { // fast checks first if ( $ oid instanceof ObjectId ) { return $ oid ; } $ oidParts = self :: parseOidString ( $ oid ) ; $ type = $ oidParts [ 'type' ] ; $ ids = $ oidParts [ 'id' ] ; $ prefix = $ oidParts [ 'prefix' ] ; // check the type if ( ! ObjectFactory :: getInstance ( 'persistenceFacade' ) -> isKnownType ( $ type ) ) { return null ; } // check if number of ids match the type $ numPks = self :: getNumberOfPKs ( $ type ) ; if ( $ numPks == null || $ numPks != sizeof ( $ ids ) ) { return null ; } return new ObjectID ( $ type , $ ids , $ prefix ) ; }
Parse a serialized object id string into an ObjectId instance.
@param $oid The string
@return ObjectId or null, if the id cannot be parsed
Parse a serialized object id string into an ObjectId instance .