Skip to content

Commit aad9ef8

Browse files
committed
nette/utils 4.0.2
1 parent b374399 commit aad9ef8

32 files changed

Lines changed: 432 additions & 16 deletions

utils/bg/filesystem.texy

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
****************************
33

44
.[perex]
5-
[api:Nette\Utils\FileSystem] е статичен клас, който съдържа полезни функции за работа с файлова система. Едно от предимствата им пред нативните функции на PHP е, че те хвърлят изключения в случай на грешки.
5+
[api:Nette\Utils\FileSystem] е клас, който съдържа полезни функции за работа с файлова система. Едно от предимствата им пред нативните функции на PHP е, че те хвърлят изключения в случай на грешки.
66

77

88
Ако трябва да търсите файлове на диска, използвайте [Finder |finder].
@@ -176,3 +176,27 @@ platformSlashes(string $path): string .[method]
176176
```php
177177
$path = FileSystem::platformSlashes($path);
178178
```
179+
180+
181+
Статичен срещу нестатичен подход .[#toc-static-vs-non-static-approach]
182+
======================================================================
183+
184+
За да замените лесно класа `FileSystem` с друг клас, например за целите на тестването, използвайте го нестатично:
185+
186+
```php
187+
class AnyClassUsingFileSystem
188+
{
189+
public function __construct(
190+
private FileSystem $fileSystem,
191+
) {
192+
}
193+
194+
195+
public function readConfig(): string
196+
{
197+
return $this->fileSystem->read(/* ... */);
198+
}
199+
200+
...
201+
}
202+
```

utils/bg/finder.texy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ Finder::findDirectories('vendor') // всички директории
6161

6262
Можете да използвате [заместващи символи |#wildcards] `*`, `**`, `?` and `[...]` в маската. Можете дори да посочите директории, например `src/*.php` ще търси всички PHP файлове в директорията `src`.
6363

64+
Симлинковете също се считат за директории или файлове.
65+
6466

6567
Къде да търсим? .[#toc-where-to-search]
6668
---------------------------------------

utils/cs/filesystem.texy

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Souborový systém
22
****************
33

44
.[perex]
5-
[api:Nette\Utils\FileSystem] je statická třída s užitečnými funkcemi pro práci se souborovým systémem. Jednou z výhod oproti nativním PHP funkcím je, že v případě chyby vyhazují výjimky.
5+
[api:Nette\Utils\FileSystem] je třída s užitečnými funkcemi pro práci se souborovým systémem. Jednou z výhod oproti nativním PHP funkcím je, že v případě chyby vyhazují výjimky.
66

77

88
Pokud potřebujete hledat soubory na disku, použijte [Finder|finder].
@@ -176,3 +176,27 @@ Převede lomítka na znaky specifické pro aktuální platformu, tj. `\` ve Wind
176176
```php
177177
$path = FileSystem::platformSlashes($path);
178178
```
179+
180+
181+
Statický vs nestatický přístup
182+
==============================
183+
184+
Abyste kupříkladu pro účely testování mohli třídu snadno nahradit jinou (mockem), používejte ji nestaticky:
185+
186+
```php
187+
class AnyClassUsingFileSystem
188+
{
189+
public function __construct(
190+
private FileSystem $fileSystem,
191+
) {
192+
}
193+
194+
195+
public function readConfig(): string
196+
{
197+
return $this->fileSystem->read(/* ... */);
198+
}
199+
200+
...
201+
}
202+
```

utils/cs/finder.texy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ Alternativou statických metod je vytvoření instance pomocí `new Finder` (tak
6161

6262
V masce můžete používat [zástupné znaky|#Zástupné znaky] `*`, `**`, `?` a `[...]`. Dokonce můžete specifikovat i v adresáře, například `src/*.php` vyhledá všechny PHP soubory v adresáři `src`.
6363

64+
Symlinky jsou také považovány za adresáře nebo soubory.
65+
6466

6567
Kde se má hledat?
6668
-----------------

utils/de/filesystem.texy

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Dateisystem-Funktionen
22
**********************
33

44
.[perex]
5-
[api:Nette\Utils\FileSystem] ist eine statische Klasse, die nützliche Funktionen für die Arbeit mit einem Dateisystem enthält. Ein Vorteil gegenüber nativen PHP-Funktionen ist, dass sie im Fehlerfall Ausnahmen auslösen.
5+
[api:Nette\Utils\FileSystem] ist eine Klasse, die nützliche Funktionen für die Arbeit mit einem Dateisystem enthält. Ein Vorteil gegenüber nativen PHP-Funktionen ist, dass sie im Fehlerfall Ausnahmen auslösen.
66

77

88
Wenn Sie nach Dateien auf dem Datenträger suchen müssen, verwenden Sie den [Finder |finder].
@@ -176,3 +176,27 @@ Konvertiert Schrägstriche in Zeichen, die für die aktuelle Plattform spezifisc
176176
```php
177177
$path = FileSystem::platformSlashes($path);
178178
```
179+
180+
181+
Statischer vs. nicht-statischer Ansatz .[#toc-static-vs-non-static-approach]
182+
============================================================================
183+
184+
Um die Klasse `FileSystem` einfach durch eine andere Klasse zu ersetzen, z. B. zu Testzwecken, verwenden Sie sie nicht-statisch:
185+
186+
```php
187+
class AnyClassUsingFileSystem
188+
{
189+
public function __construct(
190+
private FileSystem $fileSystem,
191+
) {
192+
}
193+
194+
195+
public function readConfig(): string
196+
{
197+
return $this->fileSystem->read(/* ... */);
198+
}
199+
200+
...
201+
}
202+
```

utils/de/finder.texy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ Eine Alternative zu statischen Methoden besteht darin, mit `new Finder` eine Ins
6161

6262
Sie können [Wildcards |#wildcards] `*`, `**` verwenden, `?` and `[...]` in der Maske verwenden. Sie können sogar Verzeichnisse angeben, z. B. `src/*.php` sucht nach allen PHP-Dateien im Verzeichnis `src`.
6363

64+
Symlinks werden auch als Verzeichnisse oder Dateien betrachtet.
65+
6466

6567
Wo soll gesucht werden? .[#toc-where-to-search]
6668
-----------------------------------------------

utils/el/filesystem.texy

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
******************************
33

44
.[perex]
5-
[api:Nette\Utils\FileSystem] είναι μια στατική κλάση, η οποία περιέχει χρήσιμες συναρτήσεις για την εργασία με ένα σύστημα αρχείων. Ένα πλεονέκτημα σε σχέση με τις εγγενείς συναρτήσεις της PHP είναι ότι πετάνε εξαιρέσεις σε περίπτωση σφαλμάτων.
5+
[api:Nette\Utils\FileSystem] είναι μια κλάση, η οποία περιέχει χρήσιμες λειτουργίες για την εργασία με ένα σύστημα αρχείων. Ένα πλεονέκτημα σε σχέση με τις εγγενείς συναρτήσεις της PHP είναι ότι σε περίπτωση σφαλμάτων πετάνε εξαιρέσεις.
66

77

88
Αν θέλετε να αναζητήσετε αρχεία στο δίσκο, χρησιμοποιήστε το [Finder |finder].
@@ -176,3 +176,27 @@ platformSlashes(string $path): string .[method]
176176
```php
177177
$path = FileSystem::platformSlashes($path);
178178
```
179+
180+
181+
Στατική έναντι μη στατικής προσέγγισης .[#toc-static-vs-non-static-approach]
182+
============================================================================
183+
184+
Για να αντικαταστήσετε εύκολα την κλάση `FileSystem` με μια άλλη κλάση, για παράδειγμα για σκοπούς δοκιμών, χρησιμοποιήστε τη μη στατική:
185+
186+
```php
187+
class AnyClassUsingFileSystem
188+
{
189+
public function __construct(
190+
private FileSystem $fileSystem,
191+
) {
192+
}
193+
194+
195+
public function readConfig(): string
196+
{
197+
return $this->fileSystem->read(/* ... */);
198+
}
199+
200+
...
201+
}
202+
```

utils/el/finder.texy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ Finder::findDirectories('vendor') // όλοι οι κατάλογοι
6161

6262
Μπορείτε να χρησιμοποιήσετε [μπαλαντέρ |#wildcards] `*`, `**`, `?` and `[...]` στη μάσκα. Μπορείτε ακόμη και να καθορίσετε σε καταλόγους, για παράδειγμα, το `src/*.php` θα αναζητήσει όλα τα αρχεία PHP στον κατάλογο `src`.
6363

64+
Οι συμβολικοί σύνδεσμοι θεωρούνται επίσης κατάλογοι ή αρχεία.
65+
6466

6567
Πού να ψάξετε; .[#toc-where-to-search]
6668
--------------------------------------

utils/en/filesystem.texy

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Filesystem Functions
22
********************
33

44
.[perex]
5-
[api:Nette\Utils\FileSystem] is a static class, which contains useful functions for working with a filesystem. One advantage over native PHP functions is that they throw exceptions in case of errors.
5+
[api:Nette\Utils\FileSystem] is a class, which contains useful functions for working with a filesystem. One advantage over native PHP functions is that they throw exceptions in case of errors.
66

77

88
If you need to search for files on the disk, use the [Finder |finder].
@@ -176,3 +176,27 @@ Converts slashes to characters specific to the current platform, i.e. `\` on Win
176176
```php
177177
$path = FileSystem::platformSlashes($path);
178178
```
179+
180+
181+
Static vs Non-static Approach
182+
=============================
183+
184+
To easily replace the `FileSystem` class with another class for example for testing purposes, use it non-statically:
185+
186+
```php
187+
class AnyClassUsingFileSystem
188+
{
189+
public function __construct(
190+
private FileSystem $fileSystem,
191+
) {
192+
}
193+
194+
195+
public function readConfig(): string
196+
{
197+
return $this->fileSystem->read(/* ... */);
198+
}
199+
200+
...
201+
}
202+
```

utils/en/finder.texy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ An alternative to static methods is to create an instance using `new Finder` (th
6161

6262
You can use [#wildcards] `*`, `**`, `?` and `[...]` in the mask. You can even specify in directories, for example `src/*.php` will search for all PHP files in the `src` directory.
6363

64+
Symlinks are also considered directories or files.
65+
6466

6567
Where to Search?
6668
----------------

0 commit comments

Comments
 (0)