Inheritance: extends Controller
Example #1
0
 public function testXXX()
 {
     $expectedResult = "Hello, somkiat";
     $hello = new Hello();
     $actualResult = $hello->sayHi("somkiat");
     $this->assertEquals($expectedResult, $actualResult);
 }
Example #2
0
 /**
  * @magentoDataFixture Magento/Customer/_files/customer.php
  */
 public function testToHtml()
 {
     $this->customerSession->setCustomerId(1);
     $html = $this->block->toHtml();
     $this->assertContains("<div class=\"block block-dashboard-welcome\">", $html);
     $this->assertContains("<strong>Hello, Firstname Lastname!</strong>", $html);
 }
Example #3
0
 public static function getid()
 {
     self::$subjectid = self::$subjectid + 1;
     echo self::$subjectid;
 }
Example #4
0
<?php

namespace Com\Iesebres\Dam2\spineda\helloworldcomposer;

require __DIR__ . "/src/Hello.php";
$greetings = new Hello();
$greetings->say_Hello();
Example #5
0
 public function testRunMethod()
 {
     $hello = new Hello();
     $this->assertEquals("Hello Composer", $hello->run());
 }
Example #6
0
<?php

require '../src/Hello.php';
$hello = new Hello();
print $hello->greet();
Example #7
0
<?php

class Hello
{
    public static $greeting = 'hello';
    public static function hello_world()
    {
        print self::$greeting . " world!\n";
    }
}
Hello::hello_world();
Example #8
0
<?php

//require "Hello.php";
require __DIR__ . "/Hello.php";
$greetings = new Hello();
$greetings->sayHello();
Example #9
0
<?php

require __DIR__ . "/src/hello.php";
use Com\Iesebre\Dam2\rogermelich\helloworldComposer\hello;
/**
 * Created by PhpStorm.
 * User: roger
 * Date: 6/10/15
 * Time: 19:33
 */
$greatings = new Hello();
$greatings->sayHello();
 public function actionIndex()
 {
     $data = Hello::model()->findAll();
     $this->render('index', array('data' => $data));
 }
Example #11
0
<?php
include "Hello.php";
$a = new Hello();
$a->bj();

?>
Example #12
0
<?php

$br = php_sapi_name() == "cli" ? "" : "<br>";
if (!extension_loaded('objects2')) {
    dl('objects2.' . PHP_SHLIB_SUFFIX);
}
$obj = new Hello("leon", 32);
echo $obj->greet();
echo $obj->var;
Example #13
0
    public function setAge($age)
    {
        if ($this->chain == FALSE) {
            return $this->name = $age;
        } else {
            $this->name = $age;
            return $this;
        }
    }
    public function introduce()
    {
        if (empty($this->name)) {
            print "I need a name!";
        } else {
            if (empty($this->age)) {
                print "I dont have an age!";
            } else {
                printf("Hello there, my name is <b>%s</b> and I am <b>%s</b> years old.", $this->name, $this->age);
            }
        }
    }
}
//$hello = new Hello();
$name = "Tung";
$age = 17;
//echo $hello->setName($name);
//echo $hello->setAge($age);
//$hello->introduce();
$hello = new Hello(true);
// chaining method
$hello->setName($name)->setAge($age)->introduce();
Example #14
0
 public function getMessage()
 {
     return parent::getMessage() . ", World";
 }
<?php

// Define project specific routes using $app which is an instance of Slim
/*
For example:
$app->get('/foo/bar', function($request, $response, $args) {
    $controller = new \Project\Controllers\Index($this, $request, $response);
    return $controller->index();
});
*/
if (!S3MVC_APP_USE_MVC_ROUTES) {
    //Not using mvc routes. So at least define the default / route.
    //You can change it for your app if desired
    $app->get('/', function ($request, $response, $args) {
        $prepend_action = !S3MVC_APP_AUTO_PREPEND_ACTION_TO_ACTION_METHOD_NAMES;
        $action = $prepend_action ? 'action-index' : 'index';
        $controller = new Hello($this, 'hello', $action);
        return $controller->actionIndex();
    });
}
Example #16
0
<?php

require_once "lib/Core.php";
require_once "obj/Hello.php";
// インスタンス生成
$obj = new Hello();
// Hello World!!
$obj->sayHello();
Example #17
0
<?php

/**
 * Created by PhpStorm.
 * User: jim
 * Date: 2015/11/5
 * Time: 22:54
 */
require_once 'hello1.php';
$h = new Hello();
$h->sayHello();
$d = new Desktop();
$d->work();
Example #18
0
 public function tell()
 {
     Hello::say();
 }
Example #19
0
<?php

$c = new Hello();
echo $c->getName(), PHP_EOL;
echo Hello::DefaultHello(), PHP_EOL;
Example #20
0
<?php

class Hello
{
    protected $lang;
    function __construct($lang)
    {
        $this->lang = $lang;
    }
    function greet()
    {
        if ($this->lang == 'fr') {
            return 'Bonjour';
        }
        if ($this->lang == 'es') {
            return 'Hola';
        }
        return 'Hello';
    }
}
$hi = new Hello('es');
echo $hi->greet() . "\n";
 public function index()
 {
     $message = Hello::getMessage();
     $this->set(get_defined_vars());
 }
Example #22
0
 private function __construct($name, $option = null)
 {
     self::$name = $name;
 }