@since 5.0.0

@param string $status
@param bool $pb_export

@return string
350574
public function postStatiiConversion( $status, $pb_export ) {

		if ( ! is_bool( $pb_export ) ) {
			return $status; // Doing it wrong...
		}

		if ( $pb_export ) {
			// When pb_export = true and post_status = draft, new post_status = private
			if ( $status === 'draft' ) {
				return 'private';
			}
			// When pb_export = true and post_status = publish, new post_status = publish
			if ( $status === 'publish' ) {
				return 'publish';
			}
		} else {
			// When pb_export = false and post_status = draft, new post_status = draft
			if ( $status === 'draft' ) {
				return 'draft';
			}
			// When pb_export = false and post_status = publish, new post_status = web-only
			if ( $status === 'publish' ) {
				return 'web-only';
			}
		}

		return $status; // No change
	}
628105
public static function fetchProcesses( $status )
    {
        if ( !in_array( $status, array( self::STATUS_FINISHED, self::STATUS_PENDING, self::STATUS_WORKING ) ) )
            throw new ezcBaseValueException( '$status', $status, array( self::STATUS_FINISHED, self::STATUS_PENDING, self::STATUS_WORKING ), 'parameter' );

        return parent::fetchObjectList( self::definition(), false,
            array( 'status' => $status ),
            array( 'created' => 'asc' ) );
    }
1223549
public void serializeStatusObject(IoBuffer out, StatusObject statusObject) {
        Map<?, ?> statusMap = new BeanMap(statusObject);
        Output output = new Output(out);
        Serializer.serialize(output, statusMap);
    }
1206015
public function getByStatus($status)
    {
        $components = [];

        foreach ($this->all() as $name => $component) {
            if ($component->isStatus($status)) {
                $components[$name] = $component;
            }
        }

        return $components;
    }
868021
public static String getStatusText(int status) {
		switch (status) {
		case SSH_FX_OK:
			return "OK";
		case SSH_FX_EOF:
			return "EOF";
		case SSH_FX_NO_SUCH_FILE:
			return "No such file.";
		case SSH_FX_PERMISSION_DENIED:
			return "Permission denied.";
		case SSH_FX_FAILURE:
			return "Server responded with an unknown failure.";
		case SSH_FX_BAD_MESSAGE:
			return "Server responded to a bad message.";
		case SSH_FX_NO_CONNECTION:
			return "No connection available.";
		case SSH_FX_CONNECTION_LOST:
			return "Connection lost.";
		case SSH_FX_OP_UNSUPPORTED:
			return "The operation is unsupported.";
		case SSH_FX_INVALID_HANDLE:
		case INVALID_HANDLE:
			return "Invalid file handle.";
		case SSH_FX_NO_SUCH_PATH:
			return "No such path.";
		case SSH_FX_FILE_ALREADY_EXISTS:
			return "File already exists.";
		case SSH_FX_WRITE_PROTECT:
			return "Write protect error.";
		case SSH_FX_NO_MEDIA:
			return "No media at location";
		case SSH_FX_NO_SPACE_ON_FILESYSTEM:
			return "No space on filesystem";
		case SSH_FX_QUOTA_EXCEEDED:
			return "Quota exceeded";
		case SSH_FX_UNKNOWN_PRINCIPAL:
			return "Unknown principal";
		case SSH_FX_LOCK_CONFLICT:
			return "Lock conflict";
		case SSH_FX_DIR_NOT_EMPTY:
			return "Dir not empty";
		case SSH_FX_NOT_A_DIRECTORY:
			return "Not a directory";
		case SSH_FX_INVALID_FILENAME:
			return "Invalid filename";
		case SSH_FX_LINK_LOOP:
			return "Link loop";
		case SSH_FX_CANNOT_DELETE:
			return "Cannot delete";
		case SSH_FX_INVALID_PARAMETER:
			return "Invalid parameter";
		case SSH_FX_FILE_IS_A_DIRECTORY:
			return "File is a directory";
		case SSH_FX_BYTE_RANGE_LOCK_CONFLICT:
			return "Byte range lock conflict";
		case SSH_FX_BYTE_RANGE_LOCK_REFUSED:
			return "Byte range lock refused";
		case SSH_FX_DELETE_PENDING:
			return "Delete pending";
		case SSH_FX_FILE_CORRUPT:
			return "File corrupt";
		case SSH_FX_OWNER_INVALID:
			return "Owner invalid";
		case SSH_FX_GROUP_INVALID:
			return "Group invalid";
		case SSH_FX_NO_MATCHING_BYTE_RANGE_LOCK:
			return "No matching byte range lock";
		case INVALID_RESUME_STATE:
			return "Invalid resume state";
		default:
			return "Unknown status type " + String.valueOf(status);
		}
	}
70969
public function status($status = null)
    {
        if (null === $status) {
            return $this->status;
        }

        $this->status = $status;
        return $this;
    }
484183
public static String getStatusDescription(int status)
   {
      String description = "";

      Integer statusKey = new Integer(status);
      if (statusDescriptions.containsKey(statusKey))
      {
         description = statusDescriptions.get(statusKey);
      }

      return String.format("%s %d %s", WebDavConst.HTTPVER, status, description);
   }
567048
public static function createIncorrectStatus($status, \Exception $e = null)
    {
        $message = 'Expected server status to be "OK", got "%s" instead';

        return new static(sprintf($message, $status), null, $e);
    }
373032
public function setStatus($contentId, $version, $status)
    {
        try {
            return $this->innerGateway->setStatus($contentId, $version, $status);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
526840
public function outputJson($data = null, $message = '', $status = 200)
    {
        // 错误信息返回格式可参考：[https://developer.github.com/v3/]
        if ($status != 200 && $message !== '') {
            $data = [
                'message' => $message
            ];
        }
        parent::outputJson($data, $status);
    }
1051428
private function getMessage($status) {
		if($this->messages === false) {
			$this->messages = require(__DIR__ . '/messages.php');
		}

		return isset($this->messages[$status]) ? $this->messages[$status] : "Error: $status";
	}
1325308
public static function statusLabel($status = null)
    {
        switch ($status) {
            case User::STATUS_ACTIVE:
                $label = 'info';
                $name = ArrayHelper::getValue(User::getStatuses(), $status);
                break;
            case User::STATUS_BANNED:
                $label = 'warning';
                $name = ArrayHelper::getValue(User::getStatuses(), $status);
                break;
            default:
                $label = 'default';
                $name = ArrayHelper::getValue(User::getStatuses(), User::STATUS_REGISTERED);
        }

        return Html::tag('span', $name, ['class' => 'label label-' . $label]);
    }
572816
public function getByStatus($status)
    {
        return array_filter($this->slaves, function ($slave) use ($status) {
            return $status === Slave::ANY || $status === $slave->getStatus();
        });
    }
586030
protected function reapChild(int $pid, int $status = null) {
        // One of ours?
        if (array_key_exists($pid, $this->children)) {

            $exited = pcntl_wexitstatus($status);
            if ($this->exitMode == 'worst-case') {
                if (abs($exited) > abs($this->exit)) {
                    $this->exit = $exited;
                }
            }

            $workerType = val($pid, $this->children);
            unset($this->children[$pid]);

            // Inform payload of reaped child
            $this->payloadExec('reapedWorker', [$pid, $workerType]);

            $fleetSize = $this->getFleetSize();
            $this->log(LogLevel::DEBUG, "[{pid}] Landing fleet '{$workerType}' with PID {$pid} ({$fleetSize} still in the air)");
        }
    }
155989
private function connect($status)
    {
        if ($status === true) {
            return $db = new \SQLite3(__config()->database->sqlite_name, SQLITE3_OPEN_READWRITE);
        }
        if ($status === false) {
            return $db = null;
        }
    }
630011
public function getDeliveryExecutionsByStatus($userUri, $status)
    {
        $query = $this->getQueryBuilder()
            ->select("*")
            ->from(self::TABLE_NAME)
            ->where(self::COLUMN_USER_ID . " = :userId")
            ->andWhere(self::COLUMN_STATUS . " = :status")
            ->setParameter("userId", $userUri)
            ->setParameter("status", $status)
        ;

        return array_map(function($row) {
            return $this->parseQueryResult($row);
        }, $query->execute()->fetchAll());
    }
1031104
public static function clickable(stdClass $status): string
	{
		$all = [];
		foreach ($status->entities->hashtags as $item) {
			$all[$item->indices[0]] = ["https://twitter.com/search?q=%23$item->text", "#$item->text", $item->indices[1]];
		}
		foreach ($status->entities->urls as $item) {
			if (!isset($item->expanded_url)) {
				$all[$item->indices[0]] = [$item->url, $item->url, $item->indices[1]];
			} else {
				$all[$item->indices[0]] = [$item->expanded_url, $item->display_url, $item->indices[1]];
			}
		}
		foreach ($status->entities->user_mentions as $item) {
			$all[$item->indices[0]] = ["https://twitter.com/$item->screen_name", "@$item->screen_name", $item->indices[1]];
		}
		if (isset($status->entities->media)) {
			foreach ($status->entities->media as $item) {
				$all[$item->indices[0]] = [$item->url, $item->display_url, $item->indices[1]];
			}
		}

		krsort($all);
		$s = isset($status->full_text) ? $status->full_text : $status->text;
		foreach ($all as $pos => $item) {
			$s = iconv_substr($s, 0, $pos, 'UTF-8')
				. '<a href="' . htmlspecialchars($item[0]) . '">' . htmlspecialchars($item[1]) . '</a>'
				. iconv_substr($s, $item[2], iconv_strlen($s, 'UTF-8'), 'UTF-8');
		}
		return $s;
	}