$this->setErrorCode(self::PACKAGE_LEVEL_CHECK_OKAY);
}
+ // Prepare the package data
+ $packageData = explode(NetworkPackage::PACKAGE_DATA_SEPERATOR, $rawData);
+
// Get a state from the resolver for this package
- $stateInstance = $this->getResolverInstance()->resolveStateByPackage($this, $rawData);
+ $stateInstance = $this->getResolverInstance()->resolveStateByPackage($this, $packageData);
die('UNFINISHED:'.$stateInstance->__toString());
}
}
* Returns an state instance for a given package class
*
* @param $packageInstance An instance of a package class
- * @param $rawData The raw data
+ * @param $packageData Raw package data
* @return $stateInstance An instance of the resolved state
* @todo ~30% done
*/
- public function resolveStateByPackage (Networkable $packageInstance, $rawData) {
+ public function resolveStateByPackage (Networkable $packageInstance, array $packageData) {
+ // Init state instance
+ $stateInstance = null;
+
// Get error code
$errorCode = $packageInstance->getErrorCode();
// @TODO We need to somehow detect the state/status of the remote peer and still maintain good speed.
// @TODO So maybe some pre-instancing of classes might help here to speedup this I/O intensive process.
- $this->partialStub('errorCode=' . $errorCode . ',rawData[] = ' . gettype($rawData) . '(' . strlen($rawData) . ')');
+ $this->partialStub('errorCode=' . $errorCode . ',rawData[] = ' . gettype($rawData) . '(' . count($rawData) . ')');
+
+ // Return the prepared instance
+ return $stateInstance;
}
}