protected function createServiceFile($name, $with_interface)
    {
        $dir_option = rtrim(str_replace('/', '\\', $this->getDirOption()), '/\\');
        $dir_option = $dir_option ? '\\' . $dir_option : '';
        $classname = $this->configureName('service', $name);

        if($with_interface === true) {
            $interface = trim($this->option('interface'));
            $interface = $this->configureName('repository', $interface ?: $name);

            $stub = str_replace(
                ['{{Namespace}}', '{{BaseServiceAbstractDirectory}}', '{{InterfaceDirectory}}', '{{InterfaceName}}', '{{ClassName}}'],
                [$this->getServiceDirectoryFromConfig() . $dir_option, $this->getServiceDirectoryFromConfig(),
                $this->getRepositoryDirectoryFromConfig() . $dir_option, $interface, $classname],
                $this->files->get($this->getServiceImplementsInterfaceStub())
            );
        } else {
            $stub = str_replace(
                ['{{Namespace}}', '{{BaseServiceAbstractDirectory}}', '{{ClassName}}'],
                [$this->getServiceDirectoryFromConfig() . $dir_option, $this->getServiceDirectoryFromConfig(), $classname],
                $this->files->get($this->getServiceStub())
            );
        }

        $this->files->put(base_path() . '/' . $this->getServiceDirectory() . $this->getDirOption() . $classname . '.php', $stub);
    }