Informática Asociada ia doc & examples: templates Documentation Index Examples List


/iaLib/ia_examples/URLify_example.php


<?php $ia_example = [ 'title' => 'URLify', // fully qualified className 'summary' => '', // class summary 'full_example' => '', // full usage example, relative path from ia_examples, blank '' not shown. 'example_file' => 'code/URLify_example_code.php', // method by method example, blank '' not shown. ]; include( __DIR__ . '/template/ia_example_class.php');

/iaLib/ia_examples/code/URLify_example_code.php


/** * Usage examples for URLify * @version 1.0 * @date 2026-01 */ use ia\DocumentIt\DocumentIt; use ia\DocumentIt\DocumentIt; echo '<h3>Disclaimer: Auto generated file. Please help us setting parameters to useful values and extending the examples. </h3>'; try { echo '<ul class="usage">'; ///////// URLify::add_chars(['a' => '1', 'b' => '2', 'c' => 3]); ////////////////////////////////////////////////// echo <<< FUNCTIONDEF <li id='u_add_chars'><b>URLify::add_chars(<span class="type">array</span> \$map) <span>: </span></b> FUNCTIONDEF; echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("URLify", "add_chars")."</pre>"; echo "<ol class='usage'>"; /// display /// echo <<< DOCUMENT_EXAMPLE <li>URLify::add_chars(['a' => '1', 'b' => '2', 'c' => 3]); -&gt;&nbsp; </b><br><pre> DOCUMENT_EXAMPLE; /// run /// print_r( URLify::add_chars(['a' => '1', 'b' => '2', 'c' => 3]) ); echo "</pre>"; echo '</ol>'; ///////// URLify::remove_words(null /* =mixed= */); ////////////////////////////////////////////////// echo <<< FUNCTIONDEF <li id='u_remove_words'><b>URLify::remove_words(<span class="type">mixed</span> \$words) <span>: </span></b> FUNCTIONDEF; echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("URLify", "remove_words")."</pre>"; echo "<ol class='usage'>"; /// display /// echo <<< DOCUMENT_EXAMPLE <li>URLify::remove_words(null /* =mixed= */); -&gt;&nbsp; </b><br><pre> DOCUMENT_EXAMPLE; /// run /// print_r( URLify::remove_words(null /* =mixed= */) ); echo "</pre>"; echo '</ol>'; ///////// URLify::downcode('palabra'); ////////////////////////////////////////////////// echo <<< FUNCTIONDEF <li id='u_downcode'><b>URLify::downcode(<span class="type">string</span> \$text, <span class="type">string</span> \$language <span class="default">= ''</span>) <span>: string</span></b> FUNCTIONDEF; echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("URLify", "downcode")."</pre>"; echo "<ol class='usage'>"; /// display /// echo <<< DOCUMENT_EXAMPLE <li>URLify::downcode('palabra'); -&gt;&nbsp; DOCUMENT_EXAMPLE; /// run /// echo URLify::downcode('palabra'); echo '</ol>'; ///////// URLify::filter('palabra'); ////////////////////////////////////////////////// echo <<< FUNCTIONDEF <li id='u_filter'><b>URLify::filter(<span class="type">string \$text The</span> \$text, <span class="type">int \$length The</span> \$length <span class="default">= 60</span>, <span class="type">string</span> \$language <span class="default">= ''</span>, <span class="type">bool</span> \$file_name <span class="default">= false</span>, <span class="type">bool</span> \$use_remove_list <span class="default">= true</span>, <span class="type">bool</span> \$lower_case <span class="default">= true</span>, <span class="type">bool</span> \$treat_underscore_as_space <span class="default">= true</span>) <span>: string</span></b> FUNCTIONDEF; echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("URLify", "filter")."</pre>"; echo "<ol class='usage'>"; /// display /// echo <<< DOCUMENT_EXAMPLE <li>URLify::filter('palabra'); -&gt;&nbsp; DOCUMENT_EXAMPLE; /// run /// echo URLify::filter('palabra'); echo '</ol>'; ///////// URLify::transliterate(null /* == */); ////////////////////////////////////////////////// echo <<< FUNCTIONDEF <li id='u_transliterate'><b>URLify::transliterate(<span class="type"></span> \$text) <span>: </span></b> FUNCTIONDEF; echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("URLify", "transliterate")."</pre>"; echo "<ol class='usage'>"; /// display /// echo <<< DOCUMENT_EXAMPLE <li>URLify::transliterate(null /* == */); -&gt;&nbsp; </b><br><pre> DOCUMENT_EXAMPLE; /// run /// print_r( URLify::transliterate(null /* == */) ); echo "</pre>"; echo '</ol>'; /* PerfilExample adds new methods here */ echo '</ul>'; } catch(Exception $exception) { echo "<pre class='errorBlock'>$exception</pre>"; }

phpunit test file template


<?php use URLify; use PHPUnit\Framework\TestCase; class URLifyTest extends TestCase { /** * @dataProvider add_chars_Provider * */ public function test_add_chars($map , $expected) { $this->assertEquals($expected, URLify::add_chars($map) ); } function add_chars_Provider() { return [ 'test 1' => [ '', '' ], ]; } /** * @dataProvider remove_words_Provider * */ public function test_remove_words($words , $expected) { $this->assertEquals($expected, URLify::remove_words($words) ); } function remove_words_Provider() { return [ 'test 1' => [ '', '' ], ]; } /** * @dataProvider downcode_Provider * */ public function test_downcode($text, $language , $expected) { $this->assertEquals($expected, URLify::downcode($text, $language) ); } function downcode_Provider() { return [ 'test 1' => [ '', '', '' ], ]; } /** * @dataProvider filter_Provider * */ public function test_filter($text, $length, $language, $file_name, $use_remove_list, $lower_case, $treat_underscore_as_space , $expected) { $this->assertEquals($expected, URLify::filter($text, $length, $language, $file_name, $use_remove_list, $lower_case, $treat_underscore_as_space) ); } function filter_Provider() { return [ 'test 1' => [ '', '', '', '', '', '', '', '' ], ]; } /** * @dataProvider transliterate_Provider * */ public function test_transliterate($text , $expected) { $this->assertEquals($expected, URLify::transliterate($text) ); } function transliterate_Provider() { return [ 'test 1' => [ '', '' ], ]; } }

ia Doc