You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
msgid"In the composition example above, note that the `$cache` property is declared as `private`."
202
+
msgstr""
203
+
204
+
#. type: Plain text
205
+
#: en/concept/di-container.md
206
+
msgid"This approach embraces composition by ensuring objects have well-defined interfaces for interaction rather than direct property access, making the code more maintainable and less prone to certain types of mistakes."
207
+
msgstr""
208
+
209
+
#. type: Plain text
210
+
#: en/concept/di-container.md
211
+
msgid"This design choice provides several benefits:"
212
+
msgstr""
213
+
214
+
#. type: Bullet: '- '
215
+
#: en/concept/di-container.md
216
+
msgid"**Encapsulation**: Private properties with getters/setters allow you to control access and make future changes without breaking existing code."
217
+
msgstr""
218
+
219
+
#. type: Bullet: '- '
220
+
#: en/concept/di-container.md
221
+
msgid"**Data integrity**: Setters can validate, normalize, or format values before storing them, ensuring properties contain valid data."
222
+
msgstr""
223
+
224
+
#. type: Bullet: '- '
225
+
#: en/concept/di-container.md
226
+
msgid"**Immutability**: Private properties enable immutable object patterns where setter `with*()` methods return new instances rather than modifying the current one."
227
+
msgstr""
228
+
229
+
#. type: Bullet: '- '
230
+
#: en/concept/di-container.md
231
+
msgid"**Flexibility**: You can create read-only or write-only properties or add additional logic to property access later."
msgid"Injecting basic dependencies is simple and easy. You're choosing a place where you don't care about dependencies, which is usually an action handler, which you aren't going to unit-test ever, create instances of dependencies needed and pass these to dependent classes."
242
+
#,fuzzy
243
+
#| msgid "Injecting basic dependencies is simple and easy. You're choosing a place where you don't care about dependencies, which is usually an action handler, which you aren't going to unit-test ever, create instances of dependencies needed and pass these to dependent classes."
244
+
msgid"Injecting basic dependencies is straightforward. You're choosing a place where you don't care about dependencies, which is usually an action handler, which you aren't going to unit-test ever, create instances of dependencies needed and pass these to dependent classes."
201
245
msgstr""
202
246
"Внедрять базовые зависимости просто и легко.\n"
203
247
"Вы выбираете место, где вас не волнуют зависимости, которые обычно являются обработчиками действий и которые вы не собираетесь тестировать, создаете экземпляры необходимых зависимостей и передаете их в зависимые классы."
204
248
205
249
#. type: Plain text
206
250
#: en/concept/di-container.md
207
-
msgid"It works well when there aren't many dependencies overall and when there are no nested dependencies. When there are many and each dependency has dependencies itself, instantiating the whole hierarchy becomes a tedious process, which requires lots of code and may lead to hard to debug mistakes."
251
+
#,fuzzy
252
+
#| msgid "It works well when there aren't many dependencies overall and when there are no nested dependencies. When there are many and each dependency has dependencies itself, instantiating the whole hierarchy becomes a tedious process, which requires lots of code and may lead to hard to debug mistakes."
253
+
msgid"It works well when there are few dependencies overall and when there are no nested dependencies. When there are many and each dependency has dependencies itself, instantiating the whole hierarchy becomes a tedious process, which requires lots of code and may lead to hardly debuggable mistakes."
208
254
msgstr""
209
255
"Это хорошо работает, когда в целом зависимостей немного и нет вложенных зависимостей.\n"
210
256
"Когда их много, и каждая зависимость сама имеет зависимости, создание всей иерархии становится утомительным процессом, который требует большого количества кода и может привести к трудно отлаживаемым ошибкам."
211
257
212
258
#. type: Plain text
213
259
#: en/concept/di-container.md
214
-
msgid"Additionally, lots of dependencies, such as certain third party API wrapper, are the same for any class using it. So it makes sense to:"
260
+
#,fuzzy
261
+
#| msgid "Additionally, lots of dependencies, such as certain third party API wrapper, are the same for any class using it. So it makes sense to:"
262
+
msgid"Additionally, lots of dependencies, such as certain third-party API wrappers, are the same for any class using it. So it makes sense to:"
215
263
msgstr""
216
264
"Кроме того, многие зависимости, такие как некоторые сторонние обертки API, одинаковы для любого класса, использующего его.\n"
217
265
"Поэтому имеет смысл:"
218
266
219
267
#. type: Bullet: '- '
220
268
#: en/concept/di-container.md
221
-
msgid"Define how to instantiate such API wrapper once."
269
+
#,fuzzy
270
+
#| msgid "Define how to instantiate such API wrapper once."
271
+
msgid"Define how to instantiate such an API wrapper."
222
272
msgstr"Определить, как создать экземпляр такой обертки API один раз."
msgid"Directly referencing container in a class is a bad idea since the code becomes non-generic, coupled to container interface and, what's worse, dependencies are becoming hidden. Because of that, Yii inverts the control by automatically injecting objects from a container in some constructors and methods based on method argument types."
443
+
#,fuzzy
444
+
#| msgid "Directly referencing container in a class is a bad idea since the code becomes non-generic, coupled to container interface and, what's worse, dependencies are becoming hidden. Because of that, Yii inverts the control by automatically injecting objects from a container in some constructors and methods based on method argument types."
445
+
msgid"Directly referencing a container in a class is a bad idea since the code becomes non-generic, coupled to the container interface and, what's worse, dependencies are becoming hidden. Because of that, Yii inverts the control by automatically injecting objects from a container in some constructors and methods based on method argument types."
394
446
msgstr"Непосредственное обращение к контейнеру в классе — плохая идея, так как код становится не универсальным, сопряжен с интерфейсом контейнера и, что еще хуже, зависимости становятся скрытыми. Поэтому Yii инвертирует управление, автоматически вводя объекты из контейнера в конструкторы и методы, основываясь на типах аргументов."
395
447
396
448
#. type: Plain text
@@ -449,7 +501,9 @@ msgstr ""
449
501
450
502
#. type: Plain text
451
503
#: en/concept/di-container.md
452
-
msgid"Since it's [yiisoft/injector](https://github.com/yiisoft/injector) that instantiates and calls action handler, it checks the constructor and method argument types, get dependencies of these types from a container and pass them as arguments. That's usually called auto-wiring. It happens for sub-dependencies as well, that's if you don't give dependency explicitly, container would check if it has such a dependency first. It's enough to declare a dependency you need, and it would be got from a container automatically."
504
+
#,fuzzy
505
+
#| msgid "Since it's [yiisoft/injector](https://github.com/yiisoft/injector) that instantiates and calls action handler, it checks the constructor and method argument types, get dependencies of these types from a container and pass them as arguments. That's usually called auto-wiring. It happens for sub-dependencies as well, that's if you don't give dependency explicitly, container would check if it has such a dependency first. It's enough to declare a dependency you need, and it would be got from a container automatically."
506
+
msgid"Since it's [yiisoft/injector](https://github.com/yiisoft/injector) that instantiates and calls action handler, it checks the constructor and method argument types, gets dependencies of these types from a container and passes them as arguments. That's usually called auto-wiring. It happens for sub-dependencies as well, that's if you don't give dependency explicitly, the container would check if it has such a dependency first. It's enough to declare a dependency you need, and it would be got from a container automatically."
453
507
msgstr""
454
508
"Поскольку именно [yiisoft/injector](https://github.com/yiisoft/injector) создает экземпляр и вызывает обработчик действий - он проверяет типы аргументов конструктора и метода, получает зависимости этих типов из контейнера и передает их как аргументы.\n"
455
509
"Обычно это называется автоматическим разрешением зависимостей.\n"
0 commit comments