@param object $service

@throws ExpectationException

@return null
779656
public function verifyServiceExpectations($service)
    {
        try {
            $service->mockery_verify();
        } catch (CountValidatorException $exception) {
            throw new ExpectationException('One of the expected services was not called', $this->mink->getSession(), $exception);
        }
    }
602093
protected function propagate($service)
    {
        // Propagate the service manager
        if ($service instanceof ServiceLocatorAwareInterface) {
            $service->setServiceLocator($this->getServiceLocator());
        }

        // Propagate the logger service
        if ($service instanceof LoggerAwareInterface) {
            $logger = null;
            if ($this instanceof TaoLoggerAwareInterface) {
                $logger = $this->getLogger();
            } else {
                if ($this->getServiceLocator()->has(LoggerService::SERVICE_ID)) {
                    $logger = $this->getServiceLocator()->get(LoggerService::SERVICE_ID);
                }
            }
            if (!is_null($logger)) {
                $service->setLogger($logger);
            }
        }

        return $service;
    }
183961
public function build($service = null)
    {
        if (!$this->sender) {
            $this->sender = $this->buildGuzzleSender();
        }

        if (!$this->factory) {
            throw new RuntimeException("You need to provide a configuration or a factory for requests");
        }

        if (!$this->logger) {
            $this->logger = new NullLogger();
        }

        return $this->buildClient($this->factory, $this->sender, $this->logger, $service);
    }
141722
public function iClickOn($element)
    {
        $page = $this->getSession()->getPage();
        $findName = $page->find("css", $element);

        if (!$findName) {
            throw new ExpectationException(
                $element . " could not be found",
                $this->getSession()->getDriver()
            );
        }

        $findName->click();
    }
380109
public function createProxyClassInstance($service)
    {
        $file = $this->getProxyFilename(get_class($service));
        
        if (file_exists($file)) {
            require_once $file;
        } else {
            throw new Exception\RuntimeException(
                sprintf('Proxy class for service "%s" has not been initialized', get_class($service)));
        }
        
        $proxyService = $this->getProxyClassName(get_class($service));
        return new $proxyService($service);
    }
778475
private function init($service)
    {
        //====================================================================//
        // Debug
        Splash::log()->deb('MsgWsCall');
        //====================================================================//
        // Safety Check
        if (!$this->verify()) {
            return Splash::log()->err('ErrWsInValid');
        }
        //====================================================================//
        // Clean Data Input Buffer
        $this->cleanIn();
        //====================================================================//
        // Prepare Data Output Buffer
        //====================================================================//
        // Fill buffer with Server Core infos
        $this->outputs->server = $this->getServerInfos();
        // Remote Service to call
        $this->outputs->service = $service;
        // Share Debug Flag with Server
        $this->outputs->debug = (int) SPLASH_DEBUG;

        return true;
    }
805294
protected function validateConfig( $service ){

            // Check for config file
            if( !\Config::has('googlemaps')){

                throw new \ErrorException('Unable to find config file.');
            }

            // Validate Key parameter
            if(!array_key_exists('key', config('googlemaps') ) ){

                throw new \ErrorException('Unable to find Key parameter in configuration file.');
            }


            // Validate Key parameter
            if(!array_key_exists('service', config('googlemaps') )
                    && !array_key_exists($service, config('googlemaps.service')) ){
                throw new \ErrorException('Web service must be declared in the configuration file.');
            }

            // Validate Endpoint
            $endpointCount = count(config('googlemaps.endpoint'));
            $endpointsKeyExists = array_key_exists('endpoint', config('googlemaps'));

            if($endpointsKeyExists === false || $endpointCount < 1){
                throw new \ErrorException('End point must not be empty.');
            }


    }
811687
public function make($service)
    {
        $service = 'Google_Service_'.ucfirst($service);

        if (class_exists($service)) {
            $class = new \ReflectionClass($service);

            return $class->newInstance($this->client);
        }

        throw new UnknownServiceException($service);
    }
987398
public function go($service) {
        $rs = array('total' => 0, 'fail' => 0);

        $todoList = $this->mq->pop($service, $this->step);
        $failList = array();

        while (!empty($todoList)) {
            $rs['total'] += count($todoList);

            foreach ($todoList as $params) {
                try {
                    $isFinish = $this->youGo($service, $params);

                    if (!$isFinish) {
                        $rs['fail'] ++;
                    }
                } catch (InternalServerErrorException $ex) {
                    $rs['fail'] ++;

                    $failList[] = $params;

                    \PhalApi\DI()->logger->error('task occur exception to go',
                        array('service' => $service, 'params' => $params, 'error' => $ex->getMessage()));
                }
            }

            $todoList = $this->mq->pop($service, $this->step);
        }

        foreach ($failList as $params) {
            $this->mq->add($service, $params);
        }

        return $rs;
    }
1112992
public function setService($service)
    {
        $prefix = $this->getConfig('service_class_prefix');

        $this->service[$service] = $this->createInstance($service, $prefix, [$this->client]);
    }
631887
public function setService($key, $service)
    {
        $this->set($key, $service);
        unset($this->instanceCache[$key]);
        return $this;
    }
1328825
protected function resolveDatabaseImportCommand($service = null)
    {
        /** @var ServiceDbInterface $instance */
        $instance = $this->resolveDatabaseServiceInstance($service);

        /** @var DatabaseInterface $database */
        $database = $this->getDatabaseInfo($instance);

        switch ($database->getProtocol()) {
            case 'mysql':
                return (new MysqlCommand())
                    ->host($database->getHostname())
                    ->username($database->getUser())
                    ->password($database->getPassword())
                    ->database($database->getDatabase());
            case 'pgsql':
                return (new PgsqlCommand())
                    ->host($database->getHostname())
                    ->username($database->getUser())
                    ->password($database->getPassword())
                    ->database($database->getDatabase());
        }
    }
348422
public function createMockConfig(MockConfig $expectation)
    {
        $uri = $this->createBaseUri()->withPath(self::API_EXPECTATIONS_URL);
        // TODO: Add converter from expectation to array
        $body = @json_encode($expectation);
        if (false === $body) {
            throw new \RuntimeException('Error generating json body for request: ' . json_last_error_msg());
        }
        $request = (new PsrRequest())
            ->withUri($uri)
            ->withMethod('post')
            ->withHeader('Content-Type', 'application/json')
            ->withBody(new StringStream($body));
        $this->ensureIsNotErrorResponse($this->connection->send($request));
    }
758408
public function createResponse(
        MockConfig $expectation,
        ResponseInterface $transactionData,
        ServerRequestInterface $request
    ) {
        $url = $expectation->getProxyTo();
        $this->logger->debug('Proxying request to : ' . $url);
        $this->processScenario($expectation);
        $this->processDelay($expectation->getResponse());

        return $this->httpService->send(
            $request->withUri(new Uri($url))
        );
    }
526171
public function redefineUsingExpectation(Expectation $expectation)
    {
        $fqn = $this->function_name->fullyQualifiedName();

        $this->alias(function (...$args) use ($expectation, $fqn) {

            $mock = $expectation->mockeryExpectation()->getMock();
            $target = new ExpectationTarget(ExpectationTarget::TYPE_FUNCTION, $fqn);

            return $mock->{$target->mockMethodName()}(...$args);
        });
    }
262994
public function offsetSet($key, $service)
    {
        if ( ! is_callable($service)) {
            throw new BindingResolutionException("Service definition [{$service}] is not an instance of Closure");
        }

        $this->bind($key, $service);
    }
598518
public function getListArgumentForService(callable $service)
    {
        if (is_array($service)) {
            reset($service);
            $serviceObject = current($service);
            $serviceMethod = next($service);
            return $this->getListArgumentForMethod($serviceObject, $serviceMethod);
        }

        $errMsg = 'Unsupported type callback';
        throw new Exception\UnsupportedServiceTypeException($errMsg);
    }