@@ -93,64 +93,65 @@ public function getModule(): ?string
9393 }
9494
9595
96+ /** @deprecated */
9697 public function count (): int
9798 {
99+ trigger_error (__METHOD__ . '() is deprecated. ' , E_USER_DEPRECATED );
98100 return count ($ this ->getRouters ());
99101 }
100102
101103
102- /**
103- * @param mixed $index
104- * @param Nette\Routing\Router $router
105- */
104+ /** @deprecated */
106105 public function offsetSet ($ index , $ router ): void
107106 {
108107 if ($ index === null ) {
108+ /*if (get_class($router) === Route::class) {
109+ trigger_error(__METHOD__ . '() is deprecated, use addRoute(...)', E_USER_DEPRECATED);
110+ } else {
111+ trigger_error(__METHOD__ . '() is deprecated, use add(new ' . get_class($router) . '(...)).', E_USER_DEPRECATED);
112+ }*/
109113 $ this ->add ($ router );
110114 } else {
115+ trigger_error (__METHOD__ . '() is deprecated, use modify($index, $route). ' , E_USER_DEPRECATED );
111116 $ this ->modify ($ index , $ router );
112117 }
113118 }
114119
115120
116- /**
117- * @param int $index
118- * @return mixed
119- * @throws Nette\OutOfRangeException
120- */
121+ /** @deprecated */
121122 public function offsetGet ($ index )
122123 {
124+ trigger_error (__METHOD__ . '() is deprecated, use getRouters(). ' , E_USER_DEPRECATED );
123125 if (!$ this ->offsetExists ($ index )) {
124126 throw new Nette \OutOfRangeException ('Offset invalid or out of range ' );
125127 }
126128 return $ this ->getRouters ()[$ index ];
127129 }
128130
129131
130- /**
131- * @param int $index
132- */
132+ /** @deprecated */
133133 public function offsetExists ($ index ): bool
134134 {
135+ trigger_error (__METHOD__ . '() is deprecated. ' , E_USER_DEPRECATED );
135136 return is_int ($ index ) && $ index >= 0 && $ index < $ this ->count ();
136137 }
137138
138139
139- /**
140- * @param int $index
141- * @throws Nette\OutOfRangeException
142- */
140+ /** @deprecated */
143141 public function offsetUnset ($ index ): void
144142 {
143+ trigger_error (__METHOD__ . '() is deprecated, use modify($index, null). ' , E_USER_DEPRECATED );
145144 if (!$ this ->offsetExists ($ index )) {
146145 throw new Nette \OutOfRangeException ('Offset invalid or out of range ' );
147146 }
148147 $ this ->modify ($ index , null );
149148 }
150149
151150
151+ /** @deprecated */
152152 public function getIterator (): \ArrayIterator
153153 {
154+ trigger_error (__METHOD__ . '() is deprecated, use getRouters(). ' , E_USER_DEPRECATED );
154155 return new \ArrayIterator ($ this ->getRouters ());
155156 }
156157}
0 commit comments