1313
1414
1515/**
16- * ComponentContainer is default implementation of IContainer .
16+ * Manages a collection of child components .
1717 *
1818 * @property-read IComponent[] $components
1919 */
@@ -30,7 +30,7 @@ class Container extends Component implements IContainer
3030
3131
3232 /**
33- * Adds the component to the container.
33+ * Adds a child component to the container.
3434 * @return static
3535 * @throws Nette\InvalidStateException
3636 */
@@ -91,7 +91,7 @@ public function addComponent(IComponent $component, ?string $name, ?string $inse
9191
9292
9393 /**
94- * Removes the component from the container.
94+ * Removes a child component from the container.
9595 */
9696 public function removeComponent (IComponent $ component ): void
9797 {
@@ -106,7 +106,7 @@ public function removeComponent(IComponent $component): void
106106
107107
108108 /**
109- * Returns component specified by name or path .
109+ * Retrieves a child component by name or creates it if it doesn't exist .
110110 * @param bool $throw throw exception if component doesn't exist?
111111 * @return ($throw is true ? IComponent : ?IComponent)
112112 */
@@ -153,7 +153,7 @@ final public function getComponent(string $name, bool $throw = true): ?IComponen
153153
154154
155155 /**
156- * Component factory . Delegates the creation of components to a createComponent<Name> method.
156+ * Creates a new component . Delegates creation to createComponent<Name> method if it exists .
157157 */
158158 protected function createComponent (string $ name ): ?IComponent
159159 {
@@ -178,7 +178,7 @@ protected function createComponent(string $name): ?IComponent
178178
179179
180180 /**
181- * Returns immediate child components.
181+ * Returns all immediate child components.
182182 * @return array<int|string,IComponent>
183183 */
184184 final public function getComponents (): iterable
@@ -217,7 +217,8 @@ final public function getComponentTree(): array
217217
218218
219219 /**
220- * Descendant can override this method to disallow insert a child by throwing an Nette\InvalidStateException.
220+ * Validates a child component before it's added to the container.
221+ * Descendant classes can override this to implement custom validation logic.
221222 * @throws Nette\InvalidStateException
222223 */
223224 protected function validateChildComponent (IComponent $ child ): void
@@ -229,7 +230,7 @@ protected function validateChildComponent(IComponent $child): void
229230
230231
231232 /**
232- * Object cloning.
233+ * Handles object cloning. Clones all child components and re-sets their parents .
233234 */
234235 public function __clone ()
235236 {
0 commit comments