ФорумПрограммированиеPHP для идиотов → Не известный для меня синтаксис помоги разобраться.

Не известный для меня синтаксис помоги разобраться.

  • opqx

    Сообщения: 24 Репутация: N Группа: Кто попало

    Spritz 14 января 2012 г. 0:44

    Всех приветствую. У меня такая ситуация сложилась изучаю Kohana3.2. Открыл файл controller.php а там такой код написан


    <?php defined('SYSPATH') or die('No direct script access.');
    /**
    * Abstract controller class. Controllers should only be created using a [Request].
    *
    * Controllers methods will be automatically called in the following order by
    * the request:
    *
    * $controller = new Controller_Foo($request);
    * $controller->before();
    * $controller->action_bar();
    * $controller->after();
    *
    * The controller action should add the output it creates to
    * `$this->response->body($output)`, typically in the form of a [View], during the
    * "action" part of execution.
    *
    * @package Kohana
    * @category Controller
    * @author Kohana Team
    * @copyright © 2008-2011 Kohana Team
    * @license http://kohanaframework.org/license
    */
    abstract class Kohana_Controller {

    /**
    * @var Request Request that created the controller
    */
    public $request;

    /**
    * @var Response The response that will be returned from controller
    */
    public $response;

    /**
    * Creates a new controller instance. Each controller must be constructed
    * with the request object that created it.
    *
    * @param Request $request Request that created the controller
    * @param Response $response The request's response
    * @return void
    */
    public function __construct(Request $request, Response $response)
    {
    // Assign the request to the controller
    $this->request = $request;

    // Assign a response to the controller
    $this->response = $response;
    }

    /**
    * Automatically executed before the controller action. Can be used to set
    * class properties, do authorization checks, and execute other custom code.
    *
    * @return void
    */
    public function before()
    {
    // Nothing by default
    }

    /**
    * Automatically executed after the controller action. Can be used to apply
    * transformation to the request response, add extra output, and execute
    * other custom code.
    *
    * @return void
    */
    public function after()
    {
    // Nothing by default
    }

    } // End Controller




    Вроде все понятно и ясно, но вот я не могу понять вот эти строки


    public function __construct(Request $request, Response $response)



    Что это за слова такие "магические" Request и Response .
    Почему они там написаны и какая у них функция. Юзал поиск читал мануал, но все тщетно. Объясните мне пожалуйста или может ссылками помогите. Буду благодарен каждому. Спасибо за внимание.
  • NRG

    Сообщения: 4761 Репутация: N Группа: в ухо

    Spritz 14 января 2012 г. 0:52, спустя 8 минут 33 секунды

    http://php.net/manual/ru/language.oop5.typehinting.php

    читай внимательнее
  • opqx

    Сообщения: 24 Репутация: N Группа: Кто попало

    Spritz 14 января 2012 г. 1:08, спустя 15 минут 30 секунд

    NRG, спасибо за развёрнутый ответ, да ещё и так быстро. А я постараюсь быть повнимательней. :)
  • phpdude

    Сообщения: 26646 Репутация: N Группа: в ухо

    Spritz 14 января 2012 г. 1:23, спустя 15 минут 23 секунды

    opqx, уж постарайся ЯЗЬЬ
    Сапожник без сапог

Пожалуйста, авторизуйтесь, чтобы написать комментарий!