protected function writeServiceFile(array $aServiceDefinitions = []): BaseMaker
    {
        //  Create a temporary file
        $fTempHandle = fopen(static::SERVICE_TEMP_PATH, 'w+');
        rewind($this->fServicesHandle);
        $iLocation = 0;
        while (($sLine = fgets($this->fServicesHandle)) !== false) {
            if ($iLocation === $this->iServicesTokenLocation) {
                fwrite(
                    $fTempHandle,
                    implode("\n", $aServiceDefinitions) . "\n"
                );
            }
            fwrite($fTempHandle, $sLine);
            $iLocation = ftell($this->fServicesHandle);
        }

        //  @todo (Pablo - 2019-02-11) - Sort the services by name

        //  Move the temp services file into place
        unlink(static::SERVICE_PATH);
        rename(static::SERVICE_TEMP_PATH, static::SERVICE_PATH);
        fclose($fTempHandle);
        fclose($this->fServicesHandle);

        return $this;
    }
protected function writeServiceFile(array $aServiceDefinitions = []): BaseMaker
    {
        //  Create a temporary file
        $fTempHandle = fopen(static::SERVICE_TEMP_PATH, 'w+');
        rewind($this->fServicesHandle);
        $iLocation = 0;
        while (($sLine = fgets($this->fServicesHandle)) !== false) {
            if ($iLocation === $this->iServicesTokenLocation) {
                fwrite(
                    $fTempHandle,
                    implode("\n", $aServiceDefinitions) . "\n"
                );
            }
            fwrite($fTempHandle, $sLine);
            $iLocation = ftell($this->fServicesHandle);
        }

        //  @todo (Pablo - 2019-02-11) - Sort the services by name

        //  Move the temp services file into place
        unlink(static::SERVICE_PATH);
        rename(static::SERVICE_TEMP_PATH, static::SERVICE_PATH);
        fclose($fTempHandle);
        fclose($this->fServicesHandle);

        return $this;
    }
protected function writeServiceFile ( array $ aServiceDefinitions = [ ] ) : BaseMaker { //  Create a temporary file $ fTempHandle = fopen ( static :: SERVICE_TEMP_PATH , 'w+' ) ; rewind ( $ this -> fServicesHandle ) ; $ iLocation = 0 ; while ( ( $ sLine = fgets ( $ this -> fServicesHandle ) ) !== false ) { if ( $ iLocation === $ this -> iServicesTokenLocation ) { fwrite ( $ fTempHandle , implode ( "\n" , $ aServiceDefinitions ) . "\n" ) ; } fwrite ( $ fTempHandle , $ sLine ) ; $ iLocation = ftell ( $ this -> fServicesHandle ) ; } //  @todo (Pablo - 2019-02-11) - Sort the services by name //  Move the temp services file into place unlink ( static :: SERVICE_PATH ) ; rename ( static :: SERVICE_TEMP_PATH , static :: SERVICE_PATH ) ; fclose ( $ fTempHandle ) ; fclose ( $ this -> fServicesHandle ) ; return $ this ; }
Write the definitions to the services file

@param array $aServiceDefinitions The definitions to write

@return $this
Write the definitions to the services file