Skip to content

[add]monkey.php - #3

Open
MonkeyTedBaker wants to merge 1 commit into
glennfrom
monkey
Open

[add]monkey.php#3
MonkeyTedBaker wants to merge 1 commit into
glennfrom
monkey

Conversation

@MonkeyTedBaker

Copy link
Copy Markdown
Owner

No description provided.

Comment thread raw_data.php

function get_gyms($swLat, $swLng, $neLat, $neLng, $tstamp = 0, $oSwLat = 0, $oSwLng = 0, $oNeLat = 0, $oNeLng = 0)
{
if (!is_null($adapter)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this exactly do? looks like if theres no value its gona return the following stated, but what is it exactly?
Thanks man

@MonkeyTedBaker MonkeyTedBaker Aug 25, 2017

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$adapter is NULL when not running my fork.
It contains MonkeyFork object when running monkey fork.
Check out line 8 in raw_data.php 👆

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya on line 8 you defined get_gyms to be your class MonkeyFork, i understand now that what you did there is an alternative to not run your fork interesting, but if u have multiple forks how would you apply it? since we know theres more forks there.

@MonkeyTedBaker MonkeyTedBaker Aug 25, 2017

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't care about the rest.
As far as $adapter is concerned, it runs from adapter if it exists, else, it runs from the rest of the code.

Notice the return on line 707. If there is $adapter, it runs get_gyms from $adapter and exit the function. Otherwise, it continues as usual to process other forks.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahhh, so if no $adapter = other code for the rest of forks works, i see. Smart thats what i was missing :P

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way, I don't need to break anything in this raw_data file. No touching on messy parts as well.

Comment thread raw_data.php
function get_gyms($swLat, $swLng, $neLat, $neLng, $tstamp = 0, $oSwLat = 0, $oSwLng = 0, $oNeLat = 0, $oNeLng = 0)
{
if (!is_null($adapter)) {
return $adapter->get_gyms($swLat, $swLng, $neLat, $neLng, $tstamp, $oSwLat, $oSwLng, $oNeLat, $oNeLng);

@MonkeyTedBaker MonkeyTedBaker Aug 25, 2017

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When $adapter is defined, you can use it to get_gyms from adapter. Notice that, there is no monkey around here.

I generalized the concept of forks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants