"autoload": {
"psr-4": {
"App\\": "src/",
"AcmeBundle\\": "bundles/AcmeBundle/"
},
}
<?php
namespace AcmeBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class AcmeBundle extends Bundle
{
}
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
AcmeBundle\AcmeBundle::class => ['all' => true],
];
$builder->add('category', null, [
'choice_attr' => function ($entity, $currentChoiceKey) {
return ['data-type' => $entity->getType()];
}
]);
<input type="password" name="password" autocomplete="new-password">
<?php
$begin = new DateTime('09:00');
$end = new DateTime('21:00');
$intervals = array(
array(new DateTime('10:00'), new DateTime('10:15')),
array(new DateTime('10:15'), new DateTime('11:45')),
array(new DateTime('12:30'), new DateTime('16:00'))
);
$time = 90;
function checkInterval($begin, $end, $time) {
$intervalDiff = $begin->diff($end);
$intervalMinutes = $intervalDiff->h * 60 + $intervalDiff->i;
if ($intervalMinutes >= $time) {
echo $begin->format('H:i'), ' - ', $end->format('H:i'), "\n";
}
}
$intervalStart = $begin;
foreach ($intervals as $interval) {
checkInterval($intervalStart, $interval[0], $time);
$intervalStart = $interval[1];
}
checkInterval($intervalStart, $end, $time);
/**
* Formats paragraphs around given text for all line breaks
* <br /> added for single line return
* <p> added for double line return
*
* @param string $text Text
* @return string The text with proper <p> and <br /> tags
* @link http://book.cakephp.org/3.0/en/views/helpers/text.html#converting-text-into-paragraphs
*/
public function autoParagraph($text)
{
if (trim($text) !== '') {
$text = preg_replace('|<br[^>]*>\s*<br[^>]*>|i', "\n\n", $text . "\n");
$text = preg_replace("/\n\n+/", "\n\n", str_replace(["\r\n", "\r"], "\n", $text));
$texts = preg_split('/\n\s*\n/', $text, -1, PREG_SPLIT_NO_EMPTY);
$text = '';
foreach ($texts as $txt) {
$text .= '<p>' . nl2br(trim($txt, "\n")) . "</p>\n";
}
$text = preg_replace('|<p>\s*</p>|', '', $text);
}
return $text;
}