Code Monkey home page Code Monkey logo

bridge-swoole's Introduction

phalcon

Phalcon Framework

PDS Skeleton Scrutinizer Code Quality Code Coverage codecov

Implemented

Standard Description
PSR-3 Phalcon\Logger\Logger
PSR-4 Phalcon\Autoloader
PSR-12 Coding Standard
PSR-13 Phalcon\Html\Tag\Link
PSR-16 Phalcon\Cache\Cache

To do

Standard Description
PSR-6 Caching Interface
PSR-7 Phalcon\Http\Message
PSR-11 Container Interface
PSR-14 Event Dispatcher
PSR-15 HTTP Handlers
PSR-17 Phalcon\Http\Message
PSR-18 HTTP Client

Remaining refactoring - alignment with cphalcon (v5)

  • Annotations
  • DataMapper
  • Db
  • Dispatcher
  • Mvc
  • Paginator
  • Url

bridge-swoole's People

Contributors

jeckerson avatar sinbadxiii avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

bridge-swoole's Issues

Method getHttpHost()

Hey what about the method getHttpHost()

In Phalcon, the method looks HTTP_HOST and SERVER_NAME and SERVER_ADDR.

public function getHttpHost() -> string
    {
        var host, strict, cleanHost;

        let strict = this->strictHostCheck;

        /**
         * Get the server name from $_SERVER["HTTP_HOST"]
         */
        let host = this->getServer("HTTP_HOST");

        if !host {
            /**
             * Get the server name from $_SERVER["SERVER_NAME"]
             */
            let host = this->getServer("SERVER_NAME");
            if !host {
                /**
                 * Get the server address from $_SERVER["SERVER_ADDR"]
                 */
                let host = this->getServer("SERVER_ADDR");
            }
        }

        if host && strict {
            /**
             * Cleanup. Force lowercase as per RFC 952/2181
             */
            let cleanHost = strtolower(
                trim(host)
            );

            if memstr(cleanHost, ":") {
                let cleanHost = preg_replace("/:[[:digit:]]+$/", "", cleanHost);
            }

            /**
             * Host may contain only the ASCII letters 'a' through 'z'
             * (in a case-insensitive manner), the digits '0' through '9', and
             * the hyphen ('-') as per RFC 952/2181
             */
            if unlikely ("" !== preg_replace("/[a-z0-9-]+\.?/", "", cleanHost)) {
                throw new UnexpectedValueException("Invalid host " . host);
            }
        } else {
            let cleanHost = host;
        }

        return (string) cleanHost;
    }

Should it also be done here?

    /**
     * Gets active server host or name
     *
     * @return string
     */
    public function getHttpHost(): string
    {
        return $this->getServer('http_host') ?:
            $this->getServerName();
    }

Or use each method separately?

    /**
     * Gets active server host 
     *
     * @return string
     */
    public function getHttpHost(): string
    {
        return $this->getServer('http_host') ?: '';
    }

@Jeckerson how did you plan to do it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.