From 1990517b2263a080946853ed697a6d687262ae80 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicolas=20L=C5=93uillet?=
Date: Sat, 31 Jan 2015 15:36:04 +0100
Subject: remove Acme and AppBundle
---
src/Acme/DemoBundle/AcmeDemoBundle.php | 9 --
src/Acme/DemoBundle/Command/HelloWorldCommand.php | 48 ----------
src/Acme/DemoBundle/Controller/DemoController.php | 56 ------------
.../DemoBundle/Controller/SecuredController.php | 70 --------------
.../DemoBundle/Controller/WelcomeController.php | 19 ----
.../DependencyInjection/AcmeDemoExtension.php | 22 -----
.../EventListener/ControllerListener.php | 24 -----
src/Acme/DemoBundle/Form/ContactType.php | 20 ----
src/Acme/DemoBundle/Resources/config/routing.yml | 12 ---
src/Acme/DemoBundle/Resources/config/services.xml | 18 ----
src/Acme/DemoBundle/Resources/public/css/demo.css | 101 ---------------------
.../Resources/public/images/blue-arrow.png | Bin 181 -> 0 bytes
.../Resources/public/images/field-background.gif | Bin 63 -> 0 bytes
.../DemoBundle/Resources/public/images/logo.gif | Bin 1698 -> 0 bytes
.../DemoBundle/Resources/public/images/search.png | Bin 737 -> 0 bytes
.../Resources/public/images/welcome-configure.gif | Bin 3530 -> 0 bytes
.../Resources/public/images/welcome-demo.gif | Bin 4053 -> 0 bytes
.../Resources/public/images/welcome-quick-tour.gif | Bin 4770 -> 0 bytes
.../Resources/views/Demo/contact.html.twig | 15 ---
.../Resources/views/Demo/hello.html.twig | 9 --
.../Resources/views/Demo/index.html.twig | 14 ---
.../Resources/views/Secured/hello.html.twig | 11 ---
.../Resources/views/Secured/helloadmin.html.twig | 9 --
.../Resources/views/Secured/layout.html.twig | 6 --
.../Resources/views/Secured/login.html.twig | 35 -------
.../Resources/views/Welcome/index.html.twig | 83 -----------------
.../DemoBundle/Resources/views/layout.html.twig | 37 --------
.../Tests/Controller/DemoControllerTest.php | 45 ---------
.../DemoBundle/Twig/Extension/DemoExtension.php | 81 -----------------
29 files changed, 744 deletions(-)
delete mode 100644 src/Acme/DemoBundle/AcmeDemoBundle.php
delete mode 100644 src/Acme/DemoBundle/Command/HelloWorldCommand.php
delete mode 100644 src/Acme/DemoBundle/Controller/DemoController.php
delete mode 100644 src/Acme/DemoBundle/Controller/SecuredController.php
delete mode 100644 src/Acme/DemoBundle/Controller/WelcomeController.php
delete mode 100644 src/Acme/DemoBundle/DependencyInjection/AcmeDemoExtension.php
delete mode 100644 src/Acme/DemoBundle/EventListener/ControllerListener.php
delete mode 100644 src/Acme/DemoBundle/Form/ContactType.php
delete mode 100644 src/Acme/DemoBundle/Resources/config/routing.yml
delete mode 100644 src/Acme/DemoBundle/Resources/config/services.xml
delete mode 100644 src/Acme/DemoBundle/Resources/public/css/demo.css
delete mode 100644 src/Acme/DemoBundle/Resources/public/images/blue-arrow.png
delete mode 100644 src/Acme/DemoBundle/Resources/public/images/field-background.gif
delete mode 100644 src/Acme/DemoBundle/Resources/public/images/logo.gif
delete mode 100644 src/Acme/DemoBundle/Resources/public/images/search.png
delete mode 100644 src/Acme/DemoBundle/Resources/public/images/welcome-configure.gif
delete mode 100644 src/Acme/DemoBundle/Resources/public/images/welcome-demo.gif
delete mode 100644 src/Acme/DemoBundle/Resources/public/images/welcome-quick-tour.gif
delete mode 100644 src/Acme/DemoBundle/Resources/views/Demo/contact.html.twig
delete mode 100644 src/Acme/DemoBundle/Resources/views/Demo/hello.html.twig
delete mode 100644 src/Acme/DemoBundle/Resources/views/Demo/index.html.twig
delete mode 100644 src/Acme/DemoBundle/Resources/views/Secured/hello.html.twig
delete mode 100644 src/Acme/DemoBundle/Resources/views/Secured/helloadmin.html.twig
delete mode 100644 src/Acme/DemoBundle/Resources/views/Secured/layout.html.twig
delete mode 100644 src/Acme/DemoBundle/Resources/views/Secured/login.html.twig
delete mode 100644 src/Acme/DemoBundle/Resources/views/Welcome/index.html.twig
delete mode 100644 src/Acme/DemoBundle/Resources/views/layout.html.twig
delete mode 100644 src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php
delete mode 100644 src/Acme/DemoBundle/Twig/Extension/DemoExtension.php
(limited to 'src/Acme')
diff --git a/src/Acme/DemoBundle/AcmeDemoBundle.php b/src/Acme/DemoBundle/AcmeDemoBundle.php
deleted file mode 100644
index 269fc1e0..00000000
--- a/src/Acme/DemoBundle/AcmeDemoBundle.php
+++ /dev/null
@@ -1,9 +0,0 @@
-getContainer().
- *
- * @author Tobias Schultze
- */
-class HelloWorldCommand extends Command
-{
- /**
- * {@inheritdoc}
- */
- protected function configure()
- {
- $this
- ->setName('acme:hello')
- ->setDescription('Hello World example command')
- ->addArgument('who', InputArgument::OPTIONAL, 'Who to greet.', 'World')
- ->setHelp(<<%command.name% command greets somebody or everybody:
-
-php %command.full_name%
-
-The optional argument specifies who to greet:
-
-php %command.full_name% Fabien
-EOF
- );
- }
-
- /**
- * {@inheritdoc}
- */
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- $output->writeln(sprintf('Hello %s!', $input->getArgument('who')));
- }
-}
diff --git a/src/Acme/DemoBundle/Controller/DemoController.php b/src/Acme/DemoBundle/Controller/DemoController.php
deleted file mode 100644
index a99de891..00000000
--- a/src/Acme/DemoBundle/Controller/DemoController.php
+++ /dev/null
@@ -1,56 +0,0 @@
- $name);
- }
-
- /**
- * @Route("/contact", name="_demo_contact")
- * @Template()
- */
- public function contactAction(Request $request)
- {
- $form = $this->createForm(new ContactType());
- $form->handleRequest($request);
-
- if ($form->isValid()) {
- $mailer = $this->get('mailer');
-
- // .. setup a message and send it
- // http://symfony.com/doc/current/cookbook/email.html
-
- $request->getSession()->getFlashBag()->set('notice', 'Message sent!');
-
- return new RedirectResponse($this->generateUrl('_demo'));
- }
-
- return array('form' => $form->createView());
- }
-}
diff --git a/src/Acme/DemoBundle/Controller/SecuredController.php b/src/Acme/DemoBundle/Controller/SecuredController.php
deleted file mode 100644
index d1499e39..00000000
--- a/src/Acme/DemoBundle/Controller/SecuredController.php
+++ /dev/null
@@ -1,70 +0,0 @@
-attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
- $error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
- } else {
- $error = $request->getSession()->get(SecurityContext::AUTHENTICATION_ERROR);
- }
-
- return array(
- 'last_username' => $request->getSession()->get(SecurityContext::LAST_USERNAME),
- 'error' => $error,
- );
- }
-
- /**
- * @Route("/login_check", name="_demo_security_check")
- */
- public function securityCheckAction()
- {
- // The security layer will intercept this request
- }
-
- /**
- * @Route("/logout", name="_demo_logout")
- */
- public function logoutAction()
- {
- // The security layer will intercept this request
- }
-
- /**
- * @Route("/hello", defaults={"name"="World"}),
- * @Route("/hello/{name}", name="_demo_secured_hello")
- * @Template()
- */
- public function helloAction($name)
- {
- return array('name' => $name);
- }
-
- /**
- * @Route("/hello/admin/{name}", name="_demo_secured_hello_admin")
- * @Security("is_granted('ROLE_ADMIN')")
- * @Template()
- */
- public function helloadminAction($name)
- {
- return array('name' => $name);
- }
-}
diff --git a/src/Acme/DemoBundle/Controller/WelcomeController.php b/src/Acme/DemoBundle/Controller/WelcomeController.php
deleted file mode 100644
index 884f95bb..00000000
--- a/src/Acme/DemoBundle/Controller/WelcomeController.php
+++ /dev/null
@@ -1,19 +0,0 @@
-render('AcmeDemoBundle:Welcome:index.html.twig');
- }
-}
diff --git a/src/Acme/DemoBundle/DependencyInjection/AcmeDemoExtension.php b/src/Acme/DemoBundle/DependencyInjection/AcmeDemoExtension.php
deleted file mode 100644
index 6dfcc822..00000000
--- a/src/Acme/DemoBundle/DependencyInjection/AcmeDemoExtension.php
+++ /dev/null
@@ -1,22 +0,0 @@
-load('services.xml');
- }
-
- public function getAlias()
- {
- return 'acme_demo';
- }
-}
diff --git a/src/Acme/DemoBundle/EventListener/ControllerListener.php b/src/Acme/DemoBundle/EventListener/ControllerListener.php
deleted file mode 100644
index aa117d74..00000000
--- a/src/Acme/DemoBundle/EventListener/ControllerListener.php
+++ /dev/null
@@ -1,24 +0,0 @@
-extension = $extension;
- }
-
- public function onKernelController(FilterControllerEvent $event)
- {
- if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
- $this->extension->setController($event->getController());
- }
- }
-}
diff --git a/src/Acme/DemoBundle/Form/ContactType.php b/src/Acme/DemoBundle/Form/ContactType.php
deleted file mode 100644
index 2c76cdb2..00000000
--- a/src/Acme/DemoBundle/Form/ContactType.php
+++ /dev/null
@@ -1,20 +0,0 @@
-add('email', 'email');
- $builder->add('message', 'textarea');
- }
-
- public function getName()
- {
- return 'contact';
- }
-}
diff --git a/src/Acme/DemoBundle/Resources/config/routing.yml b/src/Acme/DemoBundle/Resources/config/routing.yml
deleted file mode 100644
index 06291a23..00000000
--- a/src/Acme/DemoBundle/Resources/config/routing.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-_welcome:
- path: /
- defaults: { _controller: AcmeDemoBundle:Welcome:index }
-
-_demo_secured:
- resource: "@AcmeDemoBundle/Controller/SecuredController.php"
- type: annotation
-
-_demo:
- resource: "@AcmeDemoBundle/Controller/DemoController.php"
- type: annotation
- prefix: /demo
diff --git a/src/Acme/DemoBundle/Resources/config/services.xml b/src/Acme/DemoBundle/Resources/config/services.xml
deleted file mode 100644
index d6274ce9..00000000
--- a/src/Acme/DemoBundle/Resources/config/services.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Acme/DemoBundle/Resources/public/css/demo.css b/src/Acme/DemoBundle/Resources/public/css/demo.css
deleted file mode 100644
index 4dd2f16c..00000000
--- a/src/Acme/DemoBundle/Resources/public/css/demo.css
+++ /dev/null
@@ -1,101 +0,0 @@
-body {
- font-size: 14px;
- font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
-}
-h1.title {
- font-size: 45px;
- padding-bottom: 30px;
-}
-.sf-reset h2 {
- font-weight: bold;
- color: #FFFFFF;
- /* Font is duplicated of body (sans-serif) */
- font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
-
- margin-bottom: 10px;
- background-color: #aacd4e;
- padding: 2px 4px;
- display: inline-block;
- text-transform: uppercase;
-
-}
-p {
- line-height: 20px;
- padding-bottom: 20px;
-}
-ul#demo-list a {
- background: url(../images/blue-arrow.png) no-repeat right 6px;
- padding-right: 10px;
- margin-right: 30px;
-}
-#symfony-header {
- position: relative;
- padding: 30px 30px 20px 30px;
-}
-.sf-reset .symfony-blocks-welcome {
- overflow: hidden;
-}
-.sf-reset .symfony-blocks-welcome > div {
- background-color: whitesmoke;
- float: left;
- width: 240px;
- margin-right: 14px;
- text-align: center;
- padding: 26px 20px;
-}
-.sf-reset .symfony-blocks-welcome > div.block-demo {
- margin-right: 0;
-}
-.sf-reset .symfony-blocks-welcome .illustration {
- padding-bottom: 20px;
-}
-.sf-reset .symfony-blocks-help {
- overflow: hidden;
-}
-.sf-reset .symfony-blocks-help {
- margin-top: 30px;
- padding: 18px;
- border: 1px solid #E6E6E6;
-}
-.sf-reset .symfony-blocks-help > div {
- width: 254px;
- float: left;
-}
-.flash-message {
- padding: 10px;
- margin: 5px;
- margin-top: 15px;
- background-color: #ffe;
-}
-.sf-reset .error {
- color: red;
-}
-#login label, #contact_form label {
- display: block;
- float: left;
- width: 90px;
-}
-.sf-reset ul#menu {
- float: right;
- margin-bottom: 20px;
- padding-left: 0;
-}
-.sf-reset #menu li {
- padding-left: 0;
- margin-right: 10px;
- display: inline;
-}
-.sf-reset a,
-.sf-reset li a {
- color: #08C;
- text-decoration: none;
-}
-.sf-reset a:hover,
-.sf-reset li a:hover {
- color: #08C;
- text-decoration: underline;
-}
-.sf-reset .symfony-content pre {
- white-space: pre;
- font-family: monospace;
-}
diff --git a/src/Acme/DemoBundle/Resources/public/images/blue-arrow.png b/src/Acme/DemoBundle/Resources/public/images/blue-arrow.png
deleted file mode 100644
index fa82d4b4..00000000
Binary files a/src/Acme/DemoBundle/Resources/public/images/blue-arrow.png and /dev/null differ
diff --git a/src/Acme/DemoBundle/Resources/public/images/field-background.gif b/src/Acme/DemoBundle/Resources/public/images/field-background.gif
deleted file mode 100644
index 7c0efc10..00000000
Binary files a/src/Acme/DemoBundle/Resources/public/images/field-background.gif and /dev/null differ
diff --git a/src/Acme/DemoBundle/Resources/public/images/logo.gif b/src/Acme/DemoBundle/Resources/public/images/logo.gif
deleted file mode 100644
index 703cf45f..00000000
Binary files a/src/Acme/DemoBundle/Resources/public/images/logo.gif and /dev/null differ
diff --git a/src/Acme/DemoBundle/Resources/public/images/search.png b/src/Acme/DemoBundle/Resources/public/images/search.png
deleted file mode 100644
index 3c88b6a4..00000000
Binary files a/src/Acme/DemoBundle/Resources/public/images/search.png and /dev/null differ
diff --git a/src/Acme/DemoBundle/Resources/public/images/welcome-configure.gif b/src/Acme/DemoBundle/Resources/public/images/welcome-configure.gif
deleted file mode 100644
index 931179a7..00000000
Binary files a/src/Acme/DemoBundle/Resources/public/images/welcome-configure.gif and /dev/null differ
diff --git a/src/Acme/DemoBundle/Resources/public/images/welcome-demo.gif b/src/Acme/DemoBundle/Resources/public/images/welcome-demo.gif
deleted file mode 100644
index 0623de54..00000000
Binary files a/src/Acme/DemoBundle/Resources/public/images/welcome-demo.gif and /dev/null differ
diff --git a/src/Acme/DemoBundle/Resources/public/images/welcome-quick-tour.gif b/src/Acme/DemoBundle/Resources/public/images/welcome-quick-tour.gif
deleted file mode 100644
index b9018b11..00000000
Binary files a/src/Acme/DemoBundle/Resources/public/images/welcome-quick-tour.gif and /dev/null differ
diff --git a/src/Acme/DemoBundle/Resources/views/Demo/contact.html.twig b/src/Acme/DemoBundle/Resources/views/Demo/contact.html.twig
deleted file mode 100644
index e5b7523b..00000000
--- a/src/Acme/DemoBundle/Resources/views/Demo/contact.html.twig
+++ /dev/null
@@ -1,15 +0,0 @@
-{% extends "AcmeDemoBundle::layout.html.twig" %}
-
-{% block title "Symfony - Contact form" %}
-
-{% block content %}
-
-{% endblock %}
diff --git a/src/Acme/DemoBundle/Resources/views/Demo/hello.html.twig b/src/Acme/DemoBundle/Resources/views/Demo/hello.html.twig
deleted file mode 100644
index 3997ff60..00000000
--- a/src/Acme/DemoBundle/Resources/views/Demo/hello.html.twig
+++ /dev/null
@@ -1,9 +0,0 @@
-{% extends "AcmeDemoBundle::layout.html.twig" %}
-
-{% block title "Hello " ~ name %}
-
-{% block content %}
- Hello {{ name }}!
-{% endblock %}
-
-{% set code = code(_self) %}
diff --git a/src/Acme/DemoBundle/Resources/views/Demo/index.html.twig b/src/Acme/DemoBundle/Resources/views/Demo/index.html.twig
deleted file mode 100644
index 454a3203..00000000
--- a/src/Acme/DemoBundle/Resources/views/Demo/index.html.twig
+++ /dev/null
@@ -1,14 +0,0 @@
-{% extends "AcmeDemoBundle::layout.html.twig" %}
-
-{% block title "Symfony - Demos" %}
-
-{% block content_header '' %}
-
-{% block content %}
- Available demos
-
-{% endblock %}
diff --git a/src/Acme/DemoBundle/Resources/views/Secured/hello.html.twig b/src/Acme/DemoBundle/Resources/views/Secured/hello.html.twig
deleted file mode 100644
index faf95cf8..00000000
--- a/src/Acme/DemoBundle/Resources/views/Secured/hello.html.twig
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "AcmeDemoBundle:Secured:layout.html.twig" %}
-
-{% block title "Hello " ~ name %}
-
-{% block content %}
- Hello {{ name }}!
-
- Hello resource secured for admin only.
-{% endblock %}
-
-{% set code = code(_self) %}
diff --git a/src/Acme/DemoBundle/Resources/views/Secured/helloadmin.html.twig b/src/Acme/DemoBundle/Resources/views/Secured/helloadmin.html.twig
deleted file mode 100644
index 4e3649f7..00000000
--- a/src/Acme/DemoBundle/Resources/views/Secured/helloadmin.html.twig
+++ /dev/null
@@ -1,9 +0,0 @@
-{% extends "AcmeDemoBundle:Secured:layout.html.twig" %}
-
-{% block title "Hello " ~ name %}
-
-{% block content %}
- Hello {{ name }} secured for Admins only!
-{% endblock %}
-
-{% set code = code(_self) %}
diff --git a/src/Acme/DemoBundle/Resources/views/Secured/layout.html.twig b/src/Acme/DemoBundle/Resources/views/Secured/layout.html.twig
deleted file mode 100644
index aeea55c5..00000000
--- a/src/Acme/DemoBundle/Resources/views/Secured/layout.html.twig
+++ /dev/null
@@ -1,6 +0,0 @@
-{% extends "AcmeDemoBundle::layout.html.twig" %}
-
-{% block content_header_more %}
- {{ parent() }}
- logged in as {{ app.user ? app.user.username : 'Anonymous' }} - Logout
-{% endblock %}
diff --git a/src/Acme/DemoBundle/Resources/views/Secured/login.html.twig b/src/Acme/DemoBundle/Resources/views/Secured/login.html.twig
deleted file mode 100644
index 3e76d1df..00000000
--- a/src/Acme/DemoBundle/Resources/views/Secured/login.html.twig
+++ /dev/null
@@ -1,35 +0,0 @@
-{% extends 'AcmeDemoBundle::layout.html.twig' %}
-
-{% block content %}
- Login
-
-
- Choose between two default users: user/userpass (ROLE_USER) or admin/adminpass (ROLE_ADMIN)
-
-
- {% if error %}
- {{ error.message }}
- {% endif %}
-
-
-{% endblock %}
-
-{% set code = code(_self) %}
diff --git a/src/Acme/DemoBundle/Resources/views/Welcome/index.html.twig b/src/Acme/DemoBundle/Resources/views/Welcome/index.html.twig
deleted file mode 100644
index ea3a7299..00000000
--- a/src/Acme/DemoBundle/Resources/views/Welcome/index.html.twig
+++ /dev/null
@@ -1,83 +0,0 @@
-{% extends 'AcmeDemoBundle::layout.html.twig' %}
-
-{% block title %}Symfony - Welcome{% endblock %}
-
-{% block content_header '' %}
-
-{% block content %}
- {% set version = constant('Symfony\\Component\\HttpKernel\\Kernel::MAJOR_VERSION') ~ '.' ~ constant('Symfony\\Component\\HttpKernel\\Kernel::MINOR_VERSION')%}
-
- Welcome!
-
- Congratulations! You have successfully installed a new Symfony application.
-
-
-
- {% if app.environment == 'dev' %}
-
- {% endif %}
-
-
-
-
-{% endblock %}
diff --git a/src/Acme/DemoBundle/Resources/views/layout.html.twig b/src/Acme/DemoBundle/Resources/views/layout.html.twig
deleted file mode 100644
index d7e97d56..00000000
--- a/src/Acme/DemoBundle/Resources/views/layout.html.twig
+++ /dev/null
@@ -1,37 +0,0 @@
-{% extends "TwigBundle::layout.html.twig" %}
-
-{% block head %}
-
-
-{% endblock %}
-
-{% block title 'Demo Bundle' %}
-
-{% block body %}
- {% for flashMessage in app.session.flashbag.get('notice') %}
-
- Notice: {{ flashMessage }}
-
- {% endfor %}
-
- {% block content_header %}
-
-
-
- {% endblock %}
-
-
- {% block content %}{% endblock %}
-
-
- {% if code is defined %}
- Code behind this page
-
- {% endif %}
-{% endblock %}
diff --git a/src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php b/src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php
deleted file mode 100644
index d2176897..00000000
--- a/src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php
+++ /dev/null
@@ -1,45 +0,0 @@
-request('GET', '/demo/hello/Fabien');
-
- $this->assertGreaterThan(0, $crawler->filter('html:contains("Hello Fabien")')->count());
- }
-
- public function testSecureSection()
- {
- $client = static::createClient();
-
- // goes to the secure page
- $crawler = $client->request('GET', '/demo/secured/hello/World');
-
- // redirects to the login page
- $crawler = $client->followRedirect();
-
- // submits the login form
- $form = $crawler->selectButton('Login')->form(array('_username' => 'admin', '_password' => 'adminpass'));
- $client->submit($form);
-
- // redirect to the original page (but now authenticated)
- $crawler = $client->followRedirect();
-
- // check that the page is the right one
- $this->assertCount(1, $crawler->filter('h1.title:contains("Hello World!")'));
-
- // click on the secure link
- $link = $crawler->selectLink('Hello resource secured')->link();
- $crawler = $client->click($link);
-
- // check that the page is the right one
- $this->assertCount(1, $crawler->filter('h1.title:contains("secured for Admins only!")'));
- }
-}
diff --git a/src/Acme/DemoBundle/Twig/Extension/DemoExtension.php b/src/Acme/DemoBundle/Twig/Extension/DemoExtension.php
deleted file mode 100644
index e6ce94f6..00000000
--- a/src/Acme/DemoBundle/Twig/Extension/DemoExtension.php
+++ /dev/null
@@ -1,81 +0,0 @@
-loader = $loader;
- }
-
- public function setController($controller)
- {
- $this->controller = $controller;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getFunctions()
- {
- return array(
- new \Twig_SimpleFunction('code', array($this, 'getCode'), array('is_safe' => array('html'))),
- );
- }
-
- public function getCode($template)
- {
- // highlight_string highlights php code only if 'getControllerCode(), true);
- $controller = str_replace('<?php ', ' ', $controller);
-
- $template = htmlspecialchars($this->getTemplateCode($template), ENT_QUOTES, 'UTF-8');
-
- // remove the code block
- $template = str_replace('{% set code = code(_self) %}', '', $template);
-
- return <<Controller Code
-$controller
-
-Template Code
-$template
-EOF;
- }
-
- protected function getControllerCode()
- {
- $class = get_class($this->controller[0]);
- if (class_exists('CG\Core\ClassUtils')) {
- $class = ClassUtils::getUserClass($class);
- }
-
- $r = new \ReflectionClass($class);
- $m = $r->getMethod($this->controller[1]);
-
- $code = file($r->getFilename());
-
- return ' '.$m->getDocComment()."\n".implode('', array_slice($code, $m->getStartline() - 1, $m->getEndLine() - $m->getStartline() + 1));
- }
-
- protected function getTemplateCode($template)
- {
- return $this->loader->getSource($template->getTemplateName());
- }
-
- /**
- * Returns the name of the extension.
- *
- * @return string The extension name
- */
- public function getName()
- {
- return 'demo';
- }
-}
--
cgit v1.2.3