AlexDvorak / PHP-Coding-Train

PHP copy of Daniel Shiffman's (Coding Train) Processing and p5.js code
0 stars 0 forks source link

workaround with classes using jsarrays #2

Open AlexDvorak opened 7 years ago

AlexDvorak commented 7 years ago

Cell class in CC10_1.php uses jsarrays as their walls property so when it is called as in was intented to the PHP Parser things it should be looking for a method when it should be looking for jsarray's __invoke function (I am unsure if this is even possible)

PHP Fatal error: Uncaught Error: Call to undefined method Cell::walls() in /Users/alexdvorak/TranslatetoPHP/Coding_Challenges/CC10/CC10_1.php:97 Stack trace:

0 /Users/alexdvorak/TranslatetoPHP/Coding_Challenges/CC10/CC10_1.php(110): removeWalls(Object(Cell), Object(Cell))

1 {main}

thrown in /Users/alexdvorak/TranslatetoPHP/Coding_Challenges/CC10/CC10_1.php on line 97

AlexDvorak commented 7 years ago

Maybe make a function in CC10_1.php to adjust wall vars until solution is found. Needs to be tested.

AlexDvorak commented 7 years ago

tested. final solution is to make a temporary duplicate of the values and do whatever manipulation or extraction is needed and then to either set the duplicate to the actual variable being modified or do nothing and leave the var alone. this is not being implemented in the jsarray class it is being implemented in the translated version file.