mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-04 01:34:07 +02:00
run php-cs-fixer
This commit is contained in:
parent
de8e83ce7e
commit
2842dffb51
41 changed files with 151 additions and 141 deletions
|
|
@ -20,7 +20,7 @@ class Connection extends RawConnection {
|
|||
/** @var Parser */
|
||||
private $parser;
|
||||
|
||||
public function __construct($command, Parser $parser, $env = array()) {
|
||||
public function __construct($command, Parser $parser, $env = []) {
|
||||
parent::__construct($command, $env);
|
||||
$this->parser = $parser;
|
||||
}
|
||||
|
|
@ -65,7 +65,7 @@ class Connection extends RawConnection {
|
|||
$promptLine = $this->readLine(); //first line is prompt
|
||||
$this->parser->checkConnectionError($promptLine);
|
||||
|
||||
$output = array();
|
||||
$output = [];
|
||||
$line = $this->readLine();
|
||||
if ($line === false) {
|
||||
$this->unknownError($promptLine);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
namespace Icewind\SMB\Wrapped;
|
||||
|
||||
|
||||
use Icewind\SMB\Change;
|
||||
use Icewind\SMB\Exception\Exception;
|
||||
use Icewind\SMB\Exception\RevisionMismatchException;
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ class Parser {
|
|||
$value = trim($value);
|
||||
|
||||
if (!isset($data[$name])) {
|
||||
$data[$name] = $value;
|
||||
$data[$name] = $value;
|
||||
}
|
||||
}
|
||||
return [
|
||||
|
|
@ -156,7 +156,7 @@ class Parser {
|
|||
array_pop($output);
|
||||
$regex = '/^\s*(.*?)\s\s\s\s+(?:([NDHARS]*)\s+)?([0-9]+)\s+(.*)$/';
|
||||
//2 spaces, filename, optional type, size, date
|
||||
$content = array();
|
||||
$content = [];
|
||||
foreach ($output as $line) {
|
||||
if (preg_match($regex, $line, $matches)) {
|
||||
list(, $name, $mode, $size, $time) = $matches;
|
||||
|
|
@ -171,14 +171,14 @@ class Parser {
|
|||
}
|
||||
|
||||
public function parseListShares($output) {
|
||||
$shareNames = array();
|
||||
$shareNames = [];
|
||||
foreach ($output as $line) {
|
||||
if (strpos($line, '|')) {
|
||||
list($type, $name, $description) = explode('|', $line);
|
||||
if (strtolower($type) === 'disk') {
|
||||
$shareNames[$name] = $description;
|
||||
}
|
||||
} else if (strpos($line, 'Disk')) {
|
||||
} elseif (strpos($line, 'Disk')) {
|
||||
// new output format
|
||||
list($name, $description) = explode('Disk', $line);
|
||||
$shareNames[trim($name)] = trim($description);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@ class Server extends AbstractServer {
|
|||
* @throws ConnectException
|
||||
*/
|
||||
public function listShares() {
|
||||
$command = sprintf('%s %s %s -L %s',
|
||||
$command = sprintf(
|
||||
'%s %s %s -L %s',
|
||||
$this->system->getSmbclientPath(),
|
||||
$this->getAuthFileArgument(),
|
||||
$this->getAuth()->getExtraCommandLineArguments(),
|
||||
|
|
@ -73,7 +74,7 @@ class Server extends AbstractServer {
|
|||
|
||||
$shareNames = $parser->parseListShares($output);
|
||||
|
||||
$shares = array();
|
||||
$shares = [];
|
||||
foreach ($shareNames as $name => $description) {
|
||||
$shares[] = $this->getShare($name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,8 @@ class Share extends AbstractShare {
|
|||
}
|
||||
|
||||
protected function getConnection() {
|
||||
$command = sprintf('%s%s -t %s %s %s %s',
|
||||
$command = sprintf(
|
||||
'%s%s -t %s %s %s %s',
|
||||
$this->system->getStdBufPath() ? $this->system->getStdBufPath() . ' -o0 ' : '',
|
||||
$this->system->getSmbclientPath(),
|
||||
$this->server->getOptions()->getTimeout(),
|
||||
|
|
@ -159,7 +160,7 @@ class Share extends AbstractShare {
|
|||
if ($path !== "" && $path !== "/") {
|
||||
$parent = dirname($path);
|
||||
$dir = $this->dir($parent);
|
||||
$file = array_values(array_filter($dir, function(IFileInfo $info) use ($path) {
|
||||
$file = array_values(array_filter($dir, function (IFileInfo $info) use ($path) {
|
||||
return $info->getPath() === $path;
|
||||
}));
|
||||
if ($file) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue