@@ -92,27 +92,36 @@ protected function setModuleValues():void{
9292 }
9393
9494 /**
95- * Returns the prepared value for the given $M_TYPE (return value depends on the output class)
95+ * Returns the prepared value for the given $M_TYPE
9696 *
97- * @return mixed|null
97+ * @return mixed|null return value depends on the output class
9898 */
9999 protected function getModuleValue (int $ M_TYPE ){
100100 return ($ this ->moduleValues [$ M_TYPE ] ?? null );
101101 }
102102
103103 /**
104- * Prepares the value for the given input (return value depends on the output class)
104+ * Returns the prepared module value at the given coordinate [$x, $y] (convenience)
105+ *
106+ * @return mixed|null
107+ */
108+ protected function getModuleValueAt (int $ x , int $ y ){
109+ return $ this ->getModuleValue ($ this ->matrix ->get ($ x , $ y ));
110+ }
111+
112+ /**
113+ * Prepares the value for the given input ()
105114 *
106115 * @param mixed $value
107116 *
108- * @return mixed
117+ * @return mixed|null return value depends on the output class
109118 */
110119 abstract protected function prepareModuleValue ($ value );
111120
112121 /**
113- * Returns a default value for either dark or light modules (return value depends on the output class)
122+ * Returns a default value for either dark or light modules
114123 *
115- * @return mixed
124+ * @return mixed|null return value depends on the output class
116125 */
117126 abstract protected function getDefaultModuleValue (bool $ isDark );
118127
@@ -161,8 +170,9 @@ protected function collectModules(Closure $transform):array{
161170 $ paths = [];
162171
163172 // collect the modules for each type
164- foreach ($ this ->matrix ->getMatrix () as $ y => $ row ){
165- foreach ($ row as $ x => $ M_TYPE ){
173+ for ($ y = 0 ; $ y < $ this ->moduleCount ; $ y ++){
174+ for ($ x = 0 ; $ x < $ this ->moduleCount ; $ x ++){
175+ $ M_TYPE = $ this ->matrix ->get ($ x , $ y );
166176 $ M_TYPE_LAYER = $ M_TYPE ;
167177
168178 if ($ this ->options ->connectPaths && !$ this ->matrix ->checkTypeIn ($ x , $ y , $ this ->options ->excludeFromConnect )){
0 commit comments