diff --git a/src/Phalcon/Container.php b/src/Phalcon/Container.php new file mode 100644 index 00000000..73a9f388 --- /dev/null +++ b/src/Phalcon/Container.php @@ -0,0 +1,34 @@ + + */ + protected $container; + + /** + * Phalcon\Di constructor + */ + public function __construct(DiInterface $container) + { + } + + /** + * Return the service + */ + public function get($name) { + } + + /** + * Whether a service exists or not in the container + */ + public function has($name) : bool + { + } +} diff --git a/src/Phalcon/Plugin.php b/src/Phalcon/Plugin.php new file mode 100644 index 00000000..5689dbdb --- /dev/null +++ b/src/Phalcon/Plugin.php @@ -0,0 +1,14 @@ + + * // Generate a URL appending the URI to the base URI + * echo $url->get("products/edit/1"); + * + * // Generate a URL for a predefined route + * echo $url->get( + * [ + * "for" => "blog-post", + * "title" => "some-cool-stuff", + * "year" => "2012", + * ] + * ); + * + */ +class Url implements UrlInterface, InjectionAwareInterface +{ + + /** + * @var null | string + */ + protected $baseUri = null; + + /** + * @var null | string + */ + protected $basePath = null; + + /** + * @var + */ + protected $container; + + protected $router; + + /** + * @var null | string + */ + protected $staticBaseUri = null; + + /** + * Generates a URL + * + * + * // Generate a URL appending the URI to the base URI + * echo $url->get("products/edit/1"); + * + * // Generate a URL for a predefined route + * echo $url->get( + * [ + * "for" => "blog-post", + * "title" => "some-cool-stuff", + * "year" => "2015", + * ] + * ); + * + * // Generate a URL with GET arguments (/show/products?id=1&name=Carrots) + * echo $url->get( + * "show/products", + * [ + * "id" => 1, + * "name" => "Carrots", + * ] + * ); + * + * // Generate an absolute URL by setting the third parameter as false. + * echo $url->get( + * "https://phalconphp.com/", + * null, + * false + * ); + * + */ + public function get($uri = null, $args = null, bool $local = null, $baseUri = null) : string + { + } + + /** + * Returns the base path + */ + public function getBasePath() : string + { + } + + /** + * Returns the prefix for all the generated urls. By default / + */ + public function getBaseUri() : string + { + } + + /** + * Returns the DependencyInjector container + */ + public function getDI() : DiInterface + { + } + + /** + * Generates a URL for a static resource + * + * + * // Generate a URL for a static resource + * echo $url->getStatic("img/logo.png"); + * + * // Generate a URL for a static predefined route + * echo $url->getStatic( + * [ + * "for" => "logo-cdn", + * ] + * ); + * + */ + public function getStatic($uri = null) : string + { + } + + /** + * Returns the prefix for all the generated static urls. By default / + */ + public function getStaticBaseUri() : string + { + } + + /** + * Sets a base path for all the generated paths + * + * + * $url->setBasePath("/var/www/htdocs/"); + * + */ + public function setBasePath(string $basePath) : UrlInterface + { + } + + /** + * Sets a prefix for all the URIs to be generated + * + * + * $url->setBaseUri("/invo/"); + * + * $url->setBaseUri("/invo/index.php/"); + * + */ + public function setBaseUri(string $baseUri) : UrlInterface + { + } + + /** + * Sets the DependencyInjector container + */ + public function setDI(DiInterface $dependencyInjector) + { + } + + /** + * Sets a prefix for all static URLs generated + * + * + * $url->setStaticBaseUri("/invo/"); + * + */ + public function setStaticBaseUri(string $staticBaseUri) : UrlInterface + { + } + + /** + * Generates a local path + */ + public function path(string $path = null) : string + { + } +} diff --git a/src/Phalcon/Urlinterface.php b/src/Phalcon/Urlinterface.php new file mode 100644 index 00000000..d107d252 --- /dev/null +++ b/src/Phalcon/Urlinterface.php @@ -0,0 +1,44 @@ + + * $asset = new \Phalcon\Assets\Asset("js", "javascripts/jquery.js"); + * + */ +class Asset implements AssetInterface +{ + /** + * @var array | null + */ + protected $attributes; + + /** + * @var bool + */ + protected $filter; + + /** + * @var bool + */ + protected $local; + + /** + * @var string + */ + protected $path; + + /** + * @var string + */ + protected $sourcePath; + + /** + * @var string + */ + protected $targetPath; + + /** + * @var string + */ + protected $targetUri; + + /** + * @var string + */ + protected $type; + + /** + * Phalcon\Assets\Asset constructor + */ + public function __construct(string $type, string $path, bool $local = true, bool $filter = true, array $attributes = []) + { + } + + /** + * Sets the asset's type + */ + public function setType(string $type) : AssetInterface + { + } + + /** + * Sets the asset's path + */ + public function setPath(string $path) : AssetInterface + { + } + + /** + * Sets if the asset is local or external + */ + public function setLocal(bool $local) : AssetInterface + { + } + + /** + * Sets if the asset must be filtered or not + */ + public function setFilter(bool $filter) : AssetInterface + { + } + + /** + * Sets extra HTML attributes + */ + public function setAttributes(array $attributes) : AssetInterface + { + } + + /** + * Sets a target uri for the generated HTML + */ + public function setTargetUri(string $targetUri) : AssetInterface + { + } + + /** + * Sets the asset's source path + */ + public function setSourcePath(string $sourcePath) : AssetInterface + { + } + + /** + * Sets the asset's target path + */ + public function setTargetPath(string $targetPath) : AssetInterface + { + } + + /** + * Returns the content of the asset as an string + * Optionally a base path where the asset is located can be set + */ + public function getContent(string $basePath = null) : string + { + } + + /** + * Returns the real target uri for the generated HTML + */ + public function getRealTargetUri() : string + { + } + + /** + * Returns the complete location where the asset is located + */ + public function getRealSourcePath(string $basePath = null) : string + { + } + + /** + * Returns the complete location where the asset must be written + */ + public function getRealTargetPath(string $basePath = null) : string + { + } + + /** + * Gets the asset's key. + */ + public function getAssetKey() : string + { + } + + /** + * Gets the asset's type. + */ + public function getType(): string + { + // TODO: Implement getType() method. + } + + /** + * Gets if the asset must be filtered or not. + */ + public function getFilter(): bool + { + // TODO: Implement getFilter() method. + } + + /** + * Gets extra HTML attributes. + */ + public function getAttributes(): array + { + // TODO: Implement getAttributes() method. + } +} diff --git a/src/Phalcon/assets/Assetinterface.php b/src/Phalcon/assets/Assetinterface.php new file mode 100644 index 00000000..f9a82da8 --- /dev/null +++ b/src/Phalcon/assets/Assetinterface.php @@ -0,0 +1,46 @@ +` tags, while the whole string is enclosed in `
` tags. + */ +class Breadcrumbs +{ + /** + * Keeps all the breadcrumbs + * + * @var array + */ + private $elements = []; + + /** + * Crumb separator + * + * @var string + */ + private $separator = " / "; + + /** + * The HTML template to use to render the breadcrumbs. + * + * @var string + */ + private $template = "
%label%
"; + + /** + * Adds a new crumb. + * + * + * // Adding a crumb with a link + * $breadcrumbs->add("Home", "/"); + * + * // Adding a crumb without a link (normally the last one) + * $breadcrumbs->add("Users"); + * + */ + public function add(string $label, string $link = "") : Breadcrumbs + { + } + + /** + * Clears the crumbx + * + * + * $breadcrumbs->clear() + * + */ + public function clear() : void + { + } + + /** + * Removes crumb by url. + * + * + * $breadcrumbs->remove("/admin/user/create"); + * + * // remove a crumb without an url (last link) + * $breadcrumbs->remove(); + * + */ + public function remove(string $link) : void + { + } + + /** + * Renders and outputs breadcrumbs based on previously set template. + * + * + * // Php Engine + * echo $breadcrumbs->render(); + * + */ + public function render() : string + { + } + + /** + * Returns the internal breadcrumbs array + */ + public function toArray() : array + { + } +} diff --git a/src/Phalcon/html/Exception.php b/src/Phalcon/html/Exception.php new file mode 100644 index 00000000..1a22c6d9 --- /dev/null +++ b/src/Phalcon/html/Exception.php @@ -0,0 +1,14 @@ + + */ + protected $container; + + /** + * @var array + */ + private $append = []; + + /** + * @var int + */ + private $docType = 5; // HTML5 + + /** + * @var + */ + private $escaper; + + /** + * @var array + */ + private $prepend = []; + + /** + * @var string + */ + private $separator = ""; + + /** + * @var string + */ + private $title = ""; + + /** + * @var array + */ + private $values = []; + + /** + * @var + */ + private $url; + + /** + * Constants + */ + const HTML32 = 1; + const HTML401_STRICT = 2; + const HTML401_TRANSITIONAL = 3; + const HTML401_FRAMESET = 4; + const HTML5 = 5; + const XHTML10_STRICT = 6; + const XHTML10_TRANSITIONAL = 7; + const XHTML10_FRAMESET = 8; + const XHTML11 = 9; + const XHTML20 = 10; + const XHTML5 = 11; + + /** + * Appends a text to current document title + */ + public function appendTitle(array $title) : Tag + { + } + + /** + * Builds a HTML input[type="button"] tag + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * + * echo $tag->button('Click Me') + * + * + * Volt syntax: + * + * {{ button('Click Me) }} + * + */ + public function button(string $name, array $parameters = []) : string + { + } + + /** + * Resets the request and internal values to avoid those fields will have + * any default value. + */ + public function clear() : void + { + } + + /** + * Builds a HTML tag + * + * Parameters + * `onlyStart` Only process the start of th element + * `selfClose` It is a self close element + * `useEol` Append PHP_EOL at the end + * + */ + public function element(string $tag, array $parameters = []) : string + { + } + + /** + * Builds the closing tag of an html element + * + * Parameters + * `useEol` Append PHP_EOL at the end + * + * + * use Phalcon\Html\Tag; + * + * $tab = new Tag(); + * + * echo $tag->elementClose( + * [ + * 'name' => 'aside', + * ] + * ); // + * + * echo $tag->elementClose( + * [ + * 'name' => 'aside', + * 'useEol' => true, + * ] + * ); // '' . PHP_EOL + * + * + */ + public function elementClose(string $tag, array $parameters = []) : string + { + } + + /** + * Returns the closing tag of a form element + */ + public function endForm(bool $eol = true) : string + { + } + + /** + * Builds a HTML FORM tag + * + * + * use Phalcon\Html\Tag; + * + * $tab = new Tag(); + * + * echo $tag->form('posts/save'); + * + * echo $tag->form( + * 'posts/save', + * [ + * "method" => "post", + * ] + * ); + * + * + * Volt syntax: + * + * {{ form('posts/save') }} + * {{ form('posts/save', ['method': 'post') }} + * + */ + public function form(string $action, array $parameters = []) : string + { + } + + /** + * Converts text to URL-friendly strings + * + * Parameters + * `text` The text to be processed + * `separator` Separator to use (default '-') + * `lowercase` Convert to lowercase + * `replace` + * + * + * use Phalcon\Html\Tag; + * + * $tab = new Tag(); + * + * echo $tag->friendlyTitle( + * [ + * 'text' => 'These are big important news', + * 'separator' => '-', + * ] + * ); + * + * + * Volt Syntax: + * + * {{ friendly_title(['text': 'These are big important news', 'separator': '-']) }} + * + */ + public function friendlyTitle(string $text, array $parameters = []) : string + { + } + + /** + * Returns the internal dependency injector + */ + public function getDI() : DiInterface + { + } + + /** + * Get the document type declaration of content. If the docType has not + * been set properly, XHTML5 is returned + */ + public function getDocType() : string + { + } + + /** + * Gets the current document title. The title will be automatically escaped. + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * + * $tag + * ->setTitleSeparator(' ') + * ->prependTitle(['Hello']) + * ->setTitle('World') + * ->appendTitle(['from Phalcon']); + * + * echo $tag->getTitle(); // Hello World from Phalcon + * echo $tag->getTitle(false); // World from Phalcon + * echo $tag->getTitle(true, false); // Hello World + * echo $tag->getTitle(false, false); // World + * + * + * Volt syntax: + * + * {{ get_title() }} + * + */ + public function getTitle(bool $prepend = true, bool $append = true) : string + { + } + + /** + * Gets the current document title separator + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * + * echo $tag->getTitleSeparator(); + * + * + * Volt syntax: + * + * {{ get_title_separator() }} + * + */ + public function getTitleSeparator() : string + { + } + + /** + * Every helper calls this function to check whether a component has a predefined + * value using `setAttribute` or value from $_POST + */ + public function getValue(string $name, array $parameters = []) { + } + + /** + * Check if a helper has a default value set using `setAttribute()` or + * value from $_POST + */ + public function hasValue(string $name) : bool + { + } + + /** + * Builds HTML IMG tags + * + * Parameters + * `local` Local resource or not (default `true`) + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * + * echo $tag->image('img/bg.png'); + * + * echo $tag->image( + * 'img/photo.jpg', + * [ + * 'alt' => 'Some Photo', + * ] + * ); + * + * echo $tag->image( + * 'http://static.mywebsite.com/img/bg.png', + * [ + * 'local' => false, + * ] + * ); + * + * + * Volt Syntax: + * + * {{ image('img/bg.png') }} + * {{ image('img/photo.jpg', ['alt': 'Some Photo') }} + * {{ image('http://static.mywebsite.com/img/bg.png', ['local': false]) }} + * + */ + public function image(string $url = "", array $parameters = []) : string + { + } + + /** + * Builds a HTML input[type="check"] tag + * + * + * echo $tag->inputCheckbox( + * [ + * 'name' => 'terms, + * 'value' => 'Y', + * ] + * ); + * + * + * Volt syntax: + * + * {{ input_checkbox(['name': 'terms, 'value': 'Y']) }} + * + * + * @param array parameters + */ + public function inputCheckbox(string $name, array $parameters = []) : string + { + } + + /** + * Builds a HTML input[type='color'] tag + */ + public function inputColor(string $name, array $parameters = []) : string + { + } + + /** + * Builds a HTML input[type='date'] tag + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * + * echo $tag->inputDate( + * [ + * 'name' => 'born', + * 'value' => '14-12-1980', + * ] + * ); + * + * + * Volt syntax: + * + * {{ input_date(['name':'born', 'value':'14-12-1980']) }} + * + */ + public function inputDate(string $name, array $parameters = []) : string + { + } + + /** + * Builds a HTML input[type='datetime'] tag + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * + * echo $tag->inputDateTime( + * [ + * 'name' => 'born', + * 'value' => '14-12-1980', + * ] + * ); + * + * + * Volt syntax: + * + * {{ input_date_time(['name':'born', 'value':'14-12-1980']) }} + * + */ + public function inputDateTime(string $name, array $parameters = []) : string + { + } + + /** + * Builds a HTML input[type='datetime-local'] tag + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * + * echo $tag->inputDateTimeLocal( + * [ + * 'name' => 'born', + * 'value' => '14-12-1980', + * ] + * ); + * + * + * Volt syntax: + * + * {{ input_date_time_local(['name':'born', 'value':'14-12-1980']) }} + * + */ + public function inputDateTimeLocal(string $name, array $parameters = []) : string + { + } + + /** + * Builds a HTML input[type='email'] tag + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * + * echo $tag->inputEmail( + * [ + * 'name' => 'email', + * ] + * ); + * + * + * Volt syntax: + * + * {{ input_email(['name': 'email']); + * + */ + public function inputEmail(string $name, array $parameters = []) : string + { + } + + /** + * Builds a HTML input[type='file'] tag + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * + * echo $tag->inputFile( + * [ + * 'name' => 'file', + * ] + * ); + * + * + * Volt syntax: + * + * {{ input_file(['name': 'file']); + * + */ + public function inputFile(string $name, array $parameters = []) : string + { + } + + /** + * Builds a HTML input[type='hidden'] tag + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * + * echo $tag->inputHidden( + * [ + * 'name' => 'my-field', + * 'value' => 'mike', + * ] + * ); + * + */ + public function inputHidden(string $name, array $parameters = []) : string + { + } + + /** + * Builds a HTML input[type="image"] tag + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * echo $tag->inputImage( + * [ + * 'src' => '/img/button.png', + * ] + * ); + * + * + * Volt syntax: + * + * {{ input_image(['src': '/img/button.png']) }} + * + */ + public function inputImage(string $name, array $parameters = []) : string + { + } + + /** + * Builds a HTML input[type='month'] tag + */ + public function inputMonth(string $name, array $parameters = []) : string + { + } + + /** + * Builds a HTML input[type='number'] tag + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * + * echo $tag->numericField( + * [ + * 'name' => 'price', + * 'min' => '1', + * 'max' => '5', + * ] + * ); + * + */ + public function inputNumeric(string $name, array $parameters = []) : string + { + } + + /** + * Builds a HTML input[type='password'] tag + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * + * echo $tag->passwordField( + * [ + * 'name' => 'my-field', + * 'size' => 30, + * ] + * ); + * + */ + public function inputPassword(string $name, array $parameters = []) : string + { + } + + /** + * Builds a HTML input[type="radio"] tag + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * + * echo $tag->inputRadio( + * [ + * 'name' => 'weather', + * 'value" => 'hot', + * ] + * ); + * + * + * Volt syntax: + * + * {{ input_radio(['name': 'weather', 'value": 'hot']) }} + * + */ + public function inputRadio(string $name, array $parameters = []) : string + { + } + + /** + * Builds a HTML input[type='range'] tag + */ + public function inputRange(string $name, array $parameters = []) : string + { + } + + /** + * Builds a HTML input[type='search'] tag + */ + public function inputSearch(string $name, array $parameters = []) : string + { + } + + /** + * Builds a HTML input[type='tel'] tag + */ + public function inputTel(string $name, array $parameters = []) : string + { + } + + /** + * Builds a HTML input[type='text'] tag + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * + * echo $tag->inputText( + * [ + * 'name' => 'my-field', + * 'size' => 30, + * ] + * ); + * + */ + public function inputText(string $name, array $parameters = []) : string + { + } + + /** + * Builds a HTML input[type='time'] tag + */ + public function inputTime(string $name, array $parameters = []) : string + { + } + + /** + * Builds a HTML input[type='url'] tag + */ + public function inputUrl(string $name, array $parameters = []) : string + { + } + + /** + * Builds a HTML input[type='week'] tag + */ + public function inputWeek(string $name, array $parameters = []) : string + { + } + + /** + * Builds a script[type="javascript"] tag + * + * Parameters + * `local` Local resource or not (default `true`) + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * echo $tag->javascript( + * 'http://ajax.googleapis.com/ajax/libs/jquery/2.2.3/jquery.min.js', + * ['local' => false] + * ); + * echo $tag->javascript('javascript/jquery.js'); + * + * + * Volt syntax: + * + * {{ javascript('http://ajax.googleapis.com/ajax/libs/jquery/2.2.3/jquery.min.js', ['local': false]) }} + * {{ javascript('javascript/jquery.js') }} + * + */ + public function javascript(string $url, array $parameters = []) : string + { + } + + /** + * Builds a HTML A tag using framework conventions + * + * Parameters + * `local` Local resource or not (default `true`) + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * + * echo $tag->link('signup/register', 'Register Here!'); + * + * echo $tag->link( + * 'signup/register', + * 'Register Here!', + * [ + * 'class' => 'btn-primary', + * ] + * ); + * + * echo $tag->link( + * 'https://phalconphp.com/', + * 'Phalcon!', + * [ + * 'local' => false, + * ] + * ); + * + * echo $tag->linkTo( + * 'https://phalconphp.com/', + * 'Phalcon!', + * [ + * 'local' => false, + * 'target' => '_new' + * ] + * ); + * + * + */ + public function link(string $url, string $text = "", array $parameters = []) : string + { + } + + /** + * Prepends a text to current document title + */ + public function prependTitle(array $title) : Tag + { + } + + /** + * Renders the title with title tags. The title is automaticall escaped + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * + * $tag + * ->setTitleSeparator(' ') + * ->prependTitle(['Hello']) + * ->setTitle('World') + * ->appendTitle(['from Phalcon']); + * + * echo $tag->renderTitle(); // Hello World from Phalcon + * echo $tag->renderTitle(false); // World from Phalcon + * echo $tag->renderTitle(true, false); // Hello World + * echo $tag->renderTitle(false, false); // World + * + * + * + * {{ render_title() }} + * + */ + public function renderTitle(bool $prepend = true, bool $append = true) : string + { + } + + /** + * Builds a HTML input[type="reset"] tag + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * + * echo $tag->reset('Reset') + * + * + * Volt syntax: + * + * {{ reset('Save') }} + * + */ + public function reset(string $name, array $parameters = []) : string + { + } + + /** + * Builds a select element. It accepts an array or a resultset from + * a Phalcon\Mvc\Model + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * + * echo $tag->select( + * 'status', + * [ + * 'id' => 'status-id', + * 'useEmpty' => true, + * 'emptyValue => '', + * 'emptyText' => 'Choose Status...', + * ], + * [ + * 'A' => 'Active', + * 'I' => 'Inactive', + * ] + * ); + * + * echo $tag->select( + * 'status', + * [ + * 'id' => 'status-id', + * 'useEmpty' => true, + * 'emptyValue => '', + * 'emptyText' => 'Choose Type...', + * 'using' => [ + * 'id, + * 'name', + * ], + * ], + * Robots::find( + * [ + * 'conditions' => 'type = :type:', + * 'bind' => [ + * 'type' => 'mechanical', + * ] + * ] + * ) + * ); + * + * + * + * @param array parameters + * @param array data + */ + public function select(string $name, array $parameters = [], $data = null) : string + { + } + + /** + * Assigns default values to generated tags by helpers + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * + * // Assigning 'peter' to 'name' component + * $tag->setAttribute('name', 'peter'); + * + * // Later in the view + * echo $tag->inputText('name'); // Will have the value 'peter' by default + * + */ + public function setAttribute(string $name, $value) : Tag + { + } + + /** + * Assigns default values to generated tags by helpers + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * + * // Assigning 'peter' to 'name' component + * $tag->setAttribute( + * [ + * 'name' => 'peter', + * ] + * ); + * + * // Later in the view + * echo $tag->inputText('name'); // Will have the value 'peter' by default + * + */ + public function setAttributes(array $values, bool $merge = false) : Tag + { + } + + /** + * Sets the dependency injector + */ + public function setDI(DiInterface $container) : void + { + } + + /** + * Set the document type of content + * + * @param int doctype A valid doctype for the content + * + * @return + */ + public function setDocType(int $doctype) : Tag + { + } + + /** + * Set the title separator of view content + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * + * $tag->setTitle('Phalcon Framework'); + * + */ + public function setTitle(string $title) : Tag + { + } + + /** + * Set the title separator of view content + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * + * echo $tag->setTitleSeparator('-'); + * + */ + public function setTitleSeparator(string $separator) : Tag + { + } + + /** + * Builds a LINK[rel="stylesheet"] tag + * + * Parameters + * `local` Local resource or not (default `true`) + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * echo $tag->stylesheet( + * 'http://fonts.googleapis.com/css?family=Rosario', + * ['local' => false] + * ); + * echo $tag->stylesheet('css/style.css'); + * + * + * Volt syntax: + * + * {{ stylesheet('http://fonts.googleapis.com/css?family=Rosario', ['local': false]) }} + * {{ stylesheet('css/style.css') }} + * + */ + public function stylesheet(string $url, array $parameters = []) : string + { + } + + /** + * Builds a HTML input[type="submit"] tag + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + *public + * echo $tag->submit('Save') + * + * + * Volt syntax: + * + * {{ submit('Save') }} + * + */ + public function submit(string $name, array $parameters = []) : string + { + } + + /** + * Builds a HTML TEXTAREA tag + * + * + * use Phalcon\Html\Tag; + * + * $tag = new Tag(); + * + * echo $tag->textArea( + * 'comments', + * [ + * 'cols' => 10, + * 'rows' => 4, + * ] + * ); + * + * + * Volt syntax: + * + * {{ text_area('comments', ['cols': 10, 'rows': 4]) }} + * + */ + public function textArea(string $name, array $parameters = []) : string + { + } + + /** + * Returns the escaper service from the DI container + */ + private function getService(string $name) + { + } + + /** + * Renders the attributes of an HTML element + */ + private function renderAttributes(string $code, array $attributes) : string + { + } + + /** + * Returns the closing tag depending on the doctype + */ + private function renderCloseTag(bool $addEol = false) : string + { + } + + /** + * Builds `input` elements + */ + private function renderInput(string $type, string $name, array $parameters = []) : string + { + } + /** + * Builds INPUT tags that implements the checked attribute + */ + private function renderInputChecked(string $type, string $name, array $parameters = []) : string + { + } + + /** + * Generates the option values or optgroup from an array + */ + private function renderSelectArray(array $options, $value, string $closeOption) : string + { + } + + /** + * Generates the option values from a resultset + */ + private function renderSelectResultset(ResulsetInterface $resultset, $using, $value, string $closeOption) : string + { + } +} diff --git a/src/Phalcon/html/Taglocator.php b/src/Phalcon/html/Taglocator.php new file mode 100644 index 00000000..2cebb261 --- /dev/null +++ b/src/Phalcon/html/Taglocator.php @@ -0,0 +1,14 @@ + + */ + protected $escaper; + + /** + * Constructor + */ + public function __construct(EscaperInterface $escaper) + { + } + + /** + * Keeps all the attributes sorted - same order all the tome + */ + protected function orderAttributes(array $overrides, array $attributes) : array + { + } + + /** + * Renders all the attributes + */ + protected function renderAttributes(array $attributes) : string + { + } + + /** + * Renders an element + */ + protected function renderElement(string $tag, string $text, array $attributes = []) + { + } + + /** + * Produces a self close tag i.e. + */ + protected function selfClose(string $tag, array $attributes = []) + { + } +} diff --git a/src/Phalcon/html/helper/Anchor.php b/src/Phalcon/html/helper/Anchor.php new file mode 100644 index 00000000..b4ecb01d --- /dev/null +++ b/src/Phalcon/html/helper/Anchor.php @@ -0,0 +1,22 @@ + + */ + protected $formatter; + + /** + * Tells if there is an active transaction or not + * + * @var bool + */ + protected $inTransaction = false; + + /** + * Array with messages queued in the transaction + * + * @var array + */ + protected $queue = []; + + /** + * Destructor cleanup + */ + public function __destruct() + { + } + + /** + * Adds a message to the queue + */ + public function add(Item $item) : void + { + } + + /** + * Starts a transaction + */ + public function begin() : AdapterInterface + { + } + + /** + * Commits the internal transaction + */ + public function commit() : AdapterInterface + { + } + + public function getFormatter() : FormatterInterface + { + } + + /** + * Returns the whether the logger is currently in an active transaction or not + */ + public function inTransaction() : bool + { + } + + /** + * Processes the message in the adapter + */ + public function process(Item $item) : void + { + } + + /** + * Rollbacks the internal transaction + */ + public function rollback() : AdapterInterface + { + } + + /** + * Sets the message formatter + */ + public function setFormatter(FormatterInterface $formatter) : AdapterInterface + { + } +} diff --git a/src/Phalcon/logger/adapter/Adapterinterface.php b/src/Phalcon/logger/adapter/Adapterinterface.php new file mode 100644 index 00000000..2cd5f6c0 --- /dev/null +++ b/src/Phalcon/logger/adapter/Adapterinterface.php @@ -0,0 +1,54 @@ + + * $logger = new \Phalcon\Logger\Adapter\Noop(); + * + * $logger->log(\Phalcon\Logger::ERROR, "This is an error"); + * $logger->error("This is another error"); + * + * $logger->close(); + * + */ +class Noop extends AbstractAdapter +{ + /** + * Closes the stream + */ + public function close() : bool + { + } + + /** + * Processes the message i.e. writes it to the file + */ + public function process(Item $item) : void + { + } +} diff --git a/src/Phalcon/logger/formatter/Abstractformatter.php b/src/Phalcon/logger/formatter/Abstractformatter.php new file mode 100644 index 00000000..1079548e --- /dev/null +++ b/src/Phalcon/logger/formatter/Abstractformatter.php @@ -0,0 +1,19 @@ + item + * + * @return string|array + */ + public function format(Item $item); +} + diff --git a/src/Phalcon/messages/Exception.php b/src/Phalcon/messages/Exception.php new file mode 100644 index 00000000..b1978f3b --- /dev/null +++ b/src/Phalcon/messages/Exception.php @@ -0,0 +1,14 @@ + + * $messages->appendMessage( + * new \Phalcon\Messages\Message("This is a message") + * ); + * + */ + public function appendMessage(MessageInterface $message) + { + } + + /** + * Appends an array of messages to the collection + * + * + * $messages->appendMessages($messagesArray); + * + * + * @param \Phalcon\Messages\MessageInterface[] messages + */ + public function appendMessages($messages) + { + } + + /** + * Returns the number of messages in the list + */ + public function count() : int + { + } + + /** + * Returns the current message in the iterator + */ + public function current() : MessageInterface + { + } + + /** + * Filters the message collection by field name + */ + public function filter(string $fieldName) : array + { + } + + /** + * Returns serialised message objects as array for json_encode. Calls + * jsonSerialize on each object if present + * + * + * $data = $messages->jsonSerialize(); + * echo json_encode($data); + * + */ + public function jsonSerialize() : array + { + } + + /** + * Returns the current position/key in the iterator + */ + public function key() : int + { + } + + /** + * Moves the internal iteration pointer to the next position + */ + public function next() : void + { + } + + /** + * Checks if an index exists + * + * + * var_dump( + * isset($message["database"]) + * ); + * + * + * @param int index + */ + public function offsetExists($index) : boolean + { + } + + /** + * Gets an attribute a message using the array syntax + * + * + * print_r( + * $messages[0] + * ); + * + */ + public function offsetGet($index) { + } + + /** + * Sets an attribute using the array-syntax + * + * + * $messages[0] = new \Phalcon\Messages\Message("This is a message"); + * + * + * @param \Phalcon\Messages\Message message + */ + public function offsetSet($index, $message) : void + { + } + + /** + * Removes a message from the list + * + * + * unset($message["database"]); + * + */ + public function offsetUnset($index) : void + { + } + + /** + * Rewinds the internal iterator + */ + public function rewind() : void + { + } + + /** + * Check if the current message in the iterator is valid + */ + public function valid() : boolean + { + } +} diff --git a/src/Phalcon/paginator/Repository.php b/src/Phalcon/paginator/Repository.php new file mode 100644 index 00000000..03fc7b1c --- /dev/null +++ b/src/Phalcon/paginator/Repository.php @@ -0,0 +1,110 @@ + + */ + private $container; + + /** + * @var |null + */ + private $handler = null; + + /** + * @var string + */ + private $name = ""; + + /** + * @var array + */ + private $options = []; + + /** + * @var string + */ + private $uniqueId = ""; + + /** + * Manager constructor. + * + * @param array options + */ + public function __construct(array $options = []) + { + } + + + /** + * Alias: Gets a session variable from an application context + */ + public function __get(string $key) { + } + + /** + * Alias: Check whether a session variable is set in an application context + */ + public function __isset(string $key) : bool + { + } + + /** + * Alias: Sets a session variable in an application context + */ + public function __set(string $key, $value) : void + { + } + + /** + * Alias: Removes a session variable from an application context + */ + public function __unset(string $key) + { + } + + /** + * Destroy/end a session + */ + public function destroy() : void + { + } + + /** + * Check whether the session has been started + */ + public function exists() : bool + { + } + + /** + * Gets a session variable from an application context + */ + public function get(string $key, $defaultValue = null, bool $remove = false) { + } + + /** + * Returns the DependencyInjector container + */ + public function getDI() : DiInterface + { + } + + /** + * Returns the stored session handler + */ + public function getHandler() : SessionHandlerInterface + { + } + + /** + * Returns the session id + */ + public function getId() : string + { + } + + /** + * Returns the name of the session + */ + public function getName() : string + { + } + + /** + * Check whether a session variable is set in an application context + */ + public function has(string $key) : bool + { + } + + /** + * Get internal options + */ + public function getOptions() : array + { + } + + /** + * Regenerates the session id using the handler. + */ + public function regenerateId($deleteOldSession = true) : ManagerInterface + { + } + + /** + * Registers a handler with the session + */ + public function registerHandler(SessionHandlerInterface $handler) : bool + { + } + + /** + * Removes a session variable from an application context + */ + public function remove(string $key) + { + } + + /** + * Sets a session variable in an application context + */ + public function set(string $key, $value) : void + { + } + + /** + * Sets the DependencyInjector container + */ + public function setDI(DiInterface $container) + { + } + + /** + * Set the handler for the session + */ + public function setHandler(SessionHandlerInterface $handler) : ManagerInterface + { + } + + /** + * Set session Id + */ + public function setId(string $id) : ManagerInterface + { + } + + /** + * Set the session name. Throw exception if the session has started + * and do not allow poop names + * + * @param string name + * + * @throws InvalidArgumentException + * + * @return Manager + */ + public function setName(string $name) : ManagerInterface + { + } + + /** + * Sets session's options + * + * @param array options + */ + public function setOptions(array $options) : void + { + } + + /** + * Starts the session (if headers are already sent the session will not be + * started) + */ + public function start() : bool + { + } + + /** + * Returns the status of the current session. + * + * @return int + */ + public function status() : int + { + } + + /** + * Returns the key prefixed + */ + private function getUniqueKey(string $key) : string + { + } +} diff --git a/src/Phalcon/session/Managerinterface.php b/src/Phalcon/session/Managerinterface.php new file mode 100644 index 00000000..0d681704 --- /dev/null +++ b/src/Phalcon/session/Managerinterface.php @@ -0,0 +1,139 @@ + + * setHandler(new Noop()); + * + */ +class Noop implements SessionHandlerInterface +{ + /** + * The connection of some adapters + */ + protected $connection; + + /** + * Session options + * + * @var array + */ + protected $options = []; + + /** + * Session prefix + * + * @var string + */ + protected $prefix = ""; + + /** + * Time To Live + * + * @var int + */ + protected $ttl = 8600; + + /** + * Constructor + */ + public function __construct(array $options = []) + { + } + + /** + * Close + */ + public function close() : bool + { + } + + /** + * Destroy + */ + public function destroy($id) : bool + { + } + + /** + * Garbage Collector + */ + public function gc($maxlifetime) : bool + { + } + + /** + * Read + */ + public function read($id) : string + { + } + + /** + * Open + */ + public function open($savePath, $sessionName) : bool + { + } + + /** + * Write + */ + public function write($id, $data) : bool + { + } + + /** + * Helper method to get the name prefixed + */ + protected function getPrefixedName($name) : string + { + } +} diff --git a/src/Phalcon/url/Exception.php b/src/Phalcon/url/Exception.php new file mode 100644 index 00000000..806bb1bb --- /dev/null +++ b/src/Phalcon/url/Exception.php @@ -0,0 +1,13 @@ + + * use Phalcon\Validation\Validator\Ip as IpValidator; + * + * $validator->add( + * "ip_address", + * new IpValidator( + * [ + * "message" => ":field must contain only ip addresses", + * "version" => IP::VERSION_4 | IP::VERSION_6, // v6 and v4. The same if not specified + * "allowReserved" => false, // False if not specified. Ignored for v6 + * "allowPrivate" => false, // False if not specified + * "allowEmpty" => false, + * ] + * ) + * ); + * + * $validator->add( + * [ + * "source_address", + * "destination_address", + * ], + * new IpValidator( + * [ + * "message" => [ + * "source_address" => "source_address must contain only ip addresses", + * "destination_address" => "destination_address must contain only ip addresses", + * ], + * "version" => [ + * "source_address" => Ip::VERSION_4 | IP::VERSION_6, + * "destination_address" => Ip::VERSION_4, + * ], + * "allowReserved" => [ + * "source_address" => false, + * "destination_address" => true, + * ], + * "allowPrivate" => [ + * "source_address" => false, + * "destination_address" => true, + * ], + * "allowEmpty" => [ + * "source_address" => false, + * "destination_address" => true, + * ], + * ] + * ) + * ); + * + */ +class Ip extends Validator +{ + const VERSION_4 = FILTER_FLAG_IPV4; + const VERSION_6 = FILTER_FLAG_IPV6; + + /** + * Executes the validation + */ + public function validate(Validation $validation, $field) : bool + { + } +}