mardi 31 juillet 2018

How Phalcon design pattern works?

I am recently start working on Phalcon. It is very good framework. I am trying to understand the design pattern of this.

Suppose that i am working on Form module. There is a class named Text and i am using this as $text = new Text("field_name");, Text class in included from use Phalcon\Forms\Element\Text;. Now i checked this namespace directory and found the Text class but there are only a render function. Here it is-

namespace Phalcon\Forms\Element;

/**
 * Phalcon\Forms\Element\Text
 *
 * Component INPUT[type=text] for forms
 */
class Text extends \Phalcon\Forms\Element
{

    /**
     * Renders the element widget
     *
     * @param array $attributes
     * @return string
     */
    public function render($attributes = null) {}

}

Nothing is here for create a form element so i checked the parent class of Text but also this is inherited by an interface and its only define the all fucntions which present in its parent interface.

There are no defication for create a form elemet. Then how it's works? How it can produce the code for an form element?

I also find such things in another module also. Please explain, is this any design pattern in oops?

I also works in npm and also checked packages they also have same design pattern.

Aucun commentaire:

Enregistrer un commentaire