/ */ namespace P4Test\Spec; use P4\Connection\ConnectionInterface; use P4\Spec\PluralAbstract; class PluralMock extends PluralAbstract { const SPEC_TYPE = 'job'; const ID_FIELD = 'Job'; /** * Determine if the given job id exists. * * @param string $id the id to check for. * @param ConnectionInterface $connection optional - a specific connection to use. * @return bool true if the given id matches an existing job. */ public static function exists($id, ConnectionInterface $connection = null) { // if no connection given, use default. $connection = $connection ?: static::getDefaultConnection(); $result = $connection->run("jobs", array("-e", "Job=$id")); return (bool) count($result->getData()); } }