Determine if the entity is on the given plan.

@param  string  $plan
@return bool
430004
public function onPlan($plan)
    {
        return ! is_null($this->subscriptions->first(function ($value) use ($plan) {
            return $value->stripe_plan === $plan && $value->valid();
        }));
    }
1273080
public function isEntity( &$entity = null )
    {
        if( isset( $this->data['entity'] ) ) {
            $entity = $this->data['entity'];
            return true;
        }
        $entity = null;
        return false;
    }
56270
function _check_for_trial_plans( $plans ) {
            /**
             * For some reason core's do_action() flattens arrays when it has a single object item. Therefore, we need to restructure the array as expected.
             *
             * @author Vova Feldman (@svovaf)
             * @since  2.1.2
             */
            if ( ! is_array( $plans ) && is_object( $plans ) ) {
                $plans = array( $plans );
            }

            $this->_storage->has_trial_plan = FS_Plan_Manager::instance()->has_trial_plan( $plans );
        }
95290
function get_plan() {
            if ( ! is_object( $this->_site ) ) {
                return false;
            }

            return FS_Plugin_Plan::is_valid_id( $this->_site->plan_id ) ?
                $this->_get_plan_by_id( $this->_site->plan_id ) :
                false;
        }
1334002
public function update( models\WiFi\Planning $planning){
        $rest = $this->getService( self::API_WIFI_PLANNING);
        $rest->PUT( $planning);

        return $rest->getResult( models\WiFi\Planning::class);
    }
111258
function _get_plan_by_id( $id ) {
            $this->_logger->entrance();

            if ( ! is_array( $this->_plans ) || 0 === count( $this->_plans ) ) {
                $this->_sync_plans();
            }

            foreach ( $this->_plans as $plan ) {
                if ( $id == $plan->id ) {
                    return $plan;
                }
            }

            return false;
        }
139118
private function getMigrationsFromPlan($plan)
    {
        /** @var $migration Migration */
        $migrations = [];
        foreach ($plan as $appName => $actionPlan) {
            foreach ($actionPlan as $name => $migrationArr) {
                $migration = $migrationArr['migration'];
                $migrations[$migration->getAppLabel()][$name] = $migration;
            }
        }

        return $migrations;
    }
1015329
public function offsetExists($offset)
    {
        if ($this->data instanceof Model) {
            return isset($this->data->$offset);
        } else {
            return isset($this->data[$offset]);
        }
    }
416742
def check_plan_id(self, plan_id) -> bool:
        
        for plan in self.catalog().plans:
            if plan.id == plan_id:
                return True
        return False
805327
private function fetch_plan_by_id( $plan_id ) {
            $this->_logger->entrance();
            $api = $this->get_current_or_network_user_api_scope();

            $result = $api->get( "/plugins/{$this->_module_id}/plans/{$plan_id}.json", true );

            return $this->is_api_result_entity( $result ) ?
                new FS_Plugin_Plan( $result ) :
                $result;
        }
280295
protected function moneyRemainingOnYearlyPlan(Plan $plan)
    {
        return ($plan->price / 365) * Carbon::today()->diffInDays(Carbon::instance(
            $this->asBraintreeSubscription()->billingPeriodEndDate
        ), false);
    }
1289398
public function isScheduledForDirtyCheck($entity)
    {
        $rootEntityName = $this->em->getClassMetadata(get_class($entity))->rootEntityName;

        return isset($this->scheduledForSynchronization[$rootEntityName][spl_object_hash($entity)]);
    }
255472
public function equals( $reference ) {
        if ( !( $reference instanceof EntityReference ) ) {
            return false;
        }

        if ( strcasecmp( $this->entityLogicalName, $reference->entityLogicalName ) !== 0 ) {
            return false;
        }

        if ( $this->getID() !== $reference->getID() ) {
            return false;
        }

        return true;
    }
1025185
function is_plan( $plan, $exact = false ) {
            $this->_logger->entrance();

            if ( ! $this->is_registered() ) {
                return false;
            }

            $plan = strtolower( $plan );

            $current_plan_name = $this->get_plan_name();

            if ( $current_plan_name === $plan ) {
                // Exact plan.
                return true;
            } else if ( $exact ) {
                // Required exact, but plans are different.
                return false;
            }

            $current_plan_order  = - 1;
            $required_plan_order = - 1;
            for ( $i = 0, $len = count( $this->_plans ); $i < $len; $i ++ ) {
                if ( $plan === $this->_plans[ $i ]->name ) {
                    $required_plan_order = $i;
                } else if ( $current_plan_name === $this->_plans[ $i ]->name ) {
                    $current_plan_order = $i;
                }
            }

            return ( $current_plan_order > $required_plan_order );
        }
974284
public function isEntityScheduled($entity)
    {
        $oid = spl_object_id($entity);

        return isset($this->entityInsertions[$oid])
            || isset($this->entityUpdates[$oid])
            || isset($this->entityDeletions[$oid]);
    }
1069373
public function offsetExists($offset) : bool
    {
        return ( isset($this->_Container[$offset]) || ($this->_DataHandler !== null && $this->_DataHandler->selectOneEntity($offset) !== false) ) ? true : false ;
    }
801293
public function contains($item)
    {
        if ($item instanceof AbstractEntity) {
            $item = $item->id;
        }
        foreach ($this->value as $entity) {
            $eId = $entity->id;
            if (!$this->isNull($eId) && $eId == $item) {
                return true;
            }
        }

        return false;
    }