Switch statement

@return string $this->__cached
4871
private function mswitch()
	{
		$this->__cached = preg_replace($this->usingDirective('switch', true), '<?php switch ($1) : ?>', $this->__cached);
		$this->__cached = preg_replace($this->usingDirective('endswitch'), '<?php endswitch ;?>', $this->__cached);
	}
268861
public function popKey()
    {
        if (strlen($this->base)) {
            $layers = explode($this->delimiter, $this->base);
            $last = count($layers) - 1;
            $layer = $layers[$last];
            if ($last > 0) {
                unset ($layers[$last]);
                $this->base = implode($this->delimiter, $layers);
            } else {
                $this->base = '';
            }
            return $layer;
        }

        return null;
    }
497675
public function findRunningChangeset()
    {
        $qb = $this->createQueryBuilder('ac')
            ->select('ac')
            ->where('ac.status = :status')
            ->addOrderBy('ac.id', 'ASC')
            ->setMaxResults(1)
            ->setParameter('status', AclChangeset::STATUS_RUNNING);

        return $qb->getQuery()->getOneOrNullResult();
    }
279620
public function getSwitchUrl()
    {
        if ($url = $this->getData('switch_url')) {
            return $url;
        }

        return $this->getUrl(
            '*/*/*',
            [
                '_current'                    => true,
                $this->getStoreVarName()      => null,
                $this->getStoreGroupVarName() => null,
                $this->getContainerVarName()  => null,
            ]
        );
    }
716153
public static function flip() {
		$arguments = func_get_args();
		$first_null = array_search( null, $arguments, true );

		if ( $first_null === false ) {
			return $arguments;
		}

		// Support integer keys only.
		$first_null = (int) $first_null;

		$arguments = array_values( array_merge(
			array_slice( $arguments, $first_null ),
			array_slice( $arguments, 0, $first_null )
		) );

		return $arguments;
	}
786534
public function first()
    {
        foreach ($this as $result) {
            if ($this->_statement && !$this->_useBuffering) {
                $this->_statement->closeCursor();
            }

            return $result;
        }
    }
725662
public function getRevKFSwitch(){
        if (isset($this->_receive['FromKfAccount']))     //原接入客服
            $array['FromKfAccount'] = $this->_receive['FromKfAccount'];
        if (isset($this->_receive['ToKfAccount']))    //转接到客服
            $array['ToKfAccount'] = $this->_receive['ToKfAccount'];
        if (isset($array) && count($array) > 0) {
            return $array;
        } else {
            return false;
        }
    }
917033
function switches() {
  return fritz.getSwitchList().then(function(switches) {
    console.log("Switches: " + switches + "\n");

    return sequence(switches.map(function(sw) {
      return function() {
        return sequence([
          function() {
            return fritz.getSwitchName(sw).then(function(name) {
              console.log("[" + sw + "] " + name);
            });
          },
          function() {
            return fritz.getSwitchPresence(sw).then(function(presence) {
              console.log("[" + sw + "] presence: " + presence);
            });
          },
          function() {
            return fritz.getSwitchState(sw).then(function(state) {
              console.log("[" + sw + "] state: " + state);
            });
          },
          function() {
            return fritz.getTemperature(sw).then(function(temp) {
              temp = isNaN(temp) ? '-' : temp + "°C";
              console.log("[" + sw + "] temp: " + temp + "\n");
            });
          }
        ]);
      };
    }));
  });
}
1358905
public static function switchBacking(string $type)
    {
        if (count(self::$store) > 0) {
            throw new \LogicException('Can not switch backing while secured strings are stored');
        }

        switch ($type) {
            case self::BACKING_OPENSSL:
                self::useOpenSslBacking();
                break;

            case self::BACKING_MCRYPT:
                self::useMcryptBacking();
                break;

            case self::BACKING_PLAINTEXT:
                self::usePlaintextBacking();
                break;

            case '__none':
                self::$encrypt = function() { throw new \Exception('No backing set'); };
                self::$decrypt = function() { return null; };
                break;

            case '__none_error':
                self::$encrypt = function() { throw new \Error('No backing set'); };
                self::$decrypt = function() { return null; };
                break;

            default:
                throw new \InvalidArgumentException('Unknown backing ' . $type);
        }

        return true;
    }
1311939
private function parse()
    {
        // Skip if already parsed!
        if ($this->parsed) {
            return;
        }

        // Type switch
        switch($this->query->mode){
            case Query::MODE_SELECT:
                $this->parseSelectQuery(); break;
            case Query::MODE_INSERT:
                $this->parseInsertQuery(); break;
            case Query::MODE_UPDATE:
                $this->parseUpdateQuery(); break;
            case Query::MODE_DELETE:
                $this->parseDeleteQuery(); break;
            case Query::MODE_TRUNCATE:
                $this->parseTruncateQuery(); break;
            case Query::MODE_ADVANCED:
                throw new QueryBuilderParseException("Query mode not yet implemented!"); break; // @codeCoverageIgnore
            case Query::MODE_NONE:
                throw new QueryBuilderParseException("Query has no mode yet!"); break; // @codeCoverageIgnore
            default:
                throw new QueryBuilderParseException("Query mode is invalid!"); break; // @codeCoverageIgnore
        }


        // Set parsed to true.
        $this->parsed = true;
    }
1228755
public function swap()
    {
        $first = $this->first;
        $this->first = $this->second;
        $this->second = $first;
        return $this;
    }
1290822
def switch(self, payload):
        """"""
        first = payload['first']
        second = payload['second']
        running = self.process_handler.is_running(first) or self.process_handler.is_running(second)
        if running:
            answer = {
                'message': "Can't switch running processes, "
                "please stop the processes before switching them.",
                'status': 'error'
            }

        else:
            switched = self.queue.switch(first, second)
            if switched:
                answer = {
                    'message': 'Entries #{} and #{} switched'.format(first, second),
                    'status': 'success'
                }
            else:
                answer = {'message': "One or both entries do not exist or are not queued/stashed.",
                          'status': 'error'}
        return answer
951767
protected function buildSelectStatement()
    {
        $changedField = $GLOBALS['TCA'][$this->type]['ctrl']['tstamp'];
        if (!empty($GLOBALS['TCA'][$this->type]['ctrl']['enablecolumns']['starttime'])) {
            $changedField = 'GREATEST(' . $GLOBALS['TCA'][$this->type]['ctrl']['enablecolumns']['starttime'] . ',' . $GLOBALS['TCA'][$this->type]['ctrl']['tstamp'] . ')';
        }
        $select = 'SELECT '
            . '\'' . $this->site->getRootPageId() . '\' as root, '
            . '\'' . $this->type . '\' AS item_type, '
            . 'uid AS item_uid, '
            . '\'' . $this->indexingConfigurationName . '\' as indexing_configuration, '
            . $this->getIndexingPriority() . ' AS indexing_priority, '
            . $changedField . ' AS changed';

        return $select;
    }
1038066
public function getChanger()
    {
        $strReturn = '';
        $changer = $this->entity->getChanger();
        if ($changer) {
            return $this->getUserFullName($changer);
        }

        return $strReturn;
    }
1087410
public function getChanged()
    {
        $values = [];

        foreach (array_keys($this->changed) as $key) {
            $values[$key] = array_key_exists($key, $this->attributes) ? $this->attributes[$key] : null;
        }

        return $values;
    }
642502
private function switchType() 
    {
        $aux = $this->config["returntype"];
        $this->config["returntype"] = $this->typetowork;
        $this->typetowork = $aux;
    }
811450
private function switchNodeIfNeeded()
    {
        $sortedNodes = $this->priorityStrategy->sort(
            $this->nodes,
            $this->nodeId
        );

        $previous = null;

        // Try to connect by priority, continue on error, return on success
        foreach($sortedNodes as $nodeCandidate) {
            // If the first recommended node is our current node and it has
            // a working connection, return early.
            // If its connection is not working, let's try and reconnect further
            // below, or find the first best connected node.
            if ($nodeCandidate->getId() === $this->nodeId &&
                $nodeCandidate->isConnected()) {
                return;
            }

            try {
                if ($nodeCandidate->isConnected()) {
                    // Say a new HELLO to the node, the cluster might have changed
                    $nodeCandidate->sayHello();
                } else {
                    $nodeCandidate->connect();
                }
            } catch (ConnectionException $e) {
                $previous = $e;
                continue;
            }

            $this->switchToNode($nodeCandidate);
            return;
        }

        throw new ConnectionException('Could not switch to any node', 0, $previous);
    }