Skip to content

Commit

Permalink
Typos & reositories & remove entity suffix & phing tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
pepakriz committed Oct 5, 2014
1 parent 91ce98f commit 473490a
Show file tree
Hide file tree
Showing 131 changed files with 3,070 additions and 2,290 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
language: php

php:
- 5.4
- 5.5
- 5.6

before_script:
- composer self-update
- composer install --no-interaction --dev

script: VERBOSE=true vendor/bin/tester tests/
script: VERBOSE=true vendor/bin/phing check
20 changes: 13 additions & 7 deletions Resources/public/js/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,19 @@ $(function () {
});
$.nette.ext('alerts', {
success: function () {
var $alert = $(".alert");
$alert.fadeTo(0, 0).fadeTo(500, 1);
window.setTimeout(function() {
$alert.fadeTo(500, 0).slideUp(500, function(){
$(this).remove();
});
}, 4000);
$('#snippet--flashes .alert').each(function () {
var $alert = $(this);

if (!$alert.data('venne-animation-apply')) {
$alert.attr('data-venne-animation-apply', true);
$alert.fadeTo(0, 0).fadeTo(500, 1);
window.setTimeout(function () {
$alert.fadeTo(500, 0).slideUp(500, function () {
$(this).remove();
});
}, 4000);
}
});
}
});
$.nette.init();
Expand Down
6 changes: 3 additions & 3 deletions Resources/templates/@layout.latte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<div class="container-fluid">

<div class="navbar-header">
<a class="{if !$presenter instanceof CmsModule\Administration\Presenters\PanelPresenter}ajax {/if}navbar-brand" href="{$presenter->link(':' . $presenter->administrationManager->defaultPresenter . ':')}"><img src="{path @venne.venne/img/logo-panel.png}" alt="Venne:CMS" /></a>
<a class="{if !$presenter instanceof CmsModule\Administration\Presenters\PanelPresenter}ajax {/if}navbar-brand" href="{$presenter->link(':Admin:' . $presenter->administrationManager->defaultPresenter . ':')}"><img src="{path @venne.venne/img/logo-panel.png}" alt="Venne:CMS" /></a>
</div>

<div class="navbar-collapse collapse">
Expand Down Expand Up @@ -102,7 +102,7 @@
{block #breadcrumb-container}
<ul class="breadcrumb breadcrumb-master pull-left">
{block #breadcrumb}
<li><a class="ajax" href="{$presenter->link(':'. $presenter->administrationManager->defaultPresenter . ':')}"><span class="glyphicon glyphicon-globe"></span> {_system.admin.dashboardBreadcrumb}</a></li>
<li><a class="ajax" href="{$presenter->link(':Admin:'. $presenter->administrationManager->defaultPresenter . ':')}"><span class="glyphicon glyphicon-globe"></span> {_system.admin.dashboardBreadcrumb}</a></li>
{/block}
</ul>
{/block}
Expand All @@ -113,7 +113,7 @@
<div class="row">
<div class="col-md-12">
<div class="container-alerts">
<div class="alerts-body" n:snippet="flashes">
<div class="alerts-body" n:snippet="flashes" data-ajax-append="true">
{control flashMessage TRUE}
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions bin/venne
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env php
<?php

include('venne.php');
16 changes: 16 additions & 0 deletions bin/venne.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

/**
* This file is part of the Venne:CMS (https://github.com/Venne)
*
* Copyright (c) 2011, 2012 Josef Kříž (http://www.josef-kriz.cz)
*
* For the full copyright and license information, please view
* the file license.txt that was distributed with this source code.
*/

$rootDir = getcwd();

$container = require $rootDir . '/app/bootstrap.php';

$container->getService('application')->run();
5 changes: 0 additions & 5 deletions build.php

This file was deleted.

10 changes: 10 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<project name="venne/venne" default="build">

<property name="path.bin" value="${path.root}/vendor/bin"/>
<property name="path.root" value="${project.basedir}"/>
<property name="path.venne.venne.root" value="${path.root}"/>

<import file="${path.root}/venne-phing.xml"/>

</project>
59 changes: 59 additions & 0 deletions build/ruleset.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0"?>
<ruleset name="venne/venne">
<rule ref="Generic.Classes.DuplicateClassName"/>
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
<rule ref="Generic.Formatting.SpaceAfterCast"/>
<rule ref="Generic.Functions.CallTimePassByReference"/>
<rule ref="Generic.Functions.OpeningFunctionBraceBsdAllman"/>
<rule ref="Generic.NamingConventions.ConstructorName"/>
<rule ref="Generic.PHP.DeprecatedFunctions"/>
<rule ref="Generic.PHP.ForbiddenFunctions"/>
<rule ref="Generic.WhiteSpace.ScopeIndent"/>
<rule ref="PEAR.Classes.ClassDeclaration"/>
<rule ref="PEAR.Commenting.InlineComment"/>
<rule ref="PEAR.Formatting.MultiLineAssignment"/>
<rule ref="PEAR.WhiteSpace.ObjectOperatorIndent"/>
<rule ref="Squiz.Commenting.DocCommentAlignment"/>
<rule ref="Squiz.Functions.GlobalFunction"/>
<rule ref="Squiz.PHP.GlobalKeyword"/>
<rule ref="Squiz.PHP.Heredoc"/>
<rule ref="Squiz.PHP.InnerFunctions"/>
<rule ref="Squiz.PHP.LowercasePHPFunctions"/>
<rule ref="Squiz.PHP.NonExecutableCode"/>
<rule ref="Squiz.Scope.StaticThisUsage"/>
<rule ref="Squiz.Strings.DoubleQuoteUsage"/>
<rule ref="Squiz.Strings.DoubleQuoteUsage.ContainsVar">
<message>Variable "%s" not allowed in double quoted string; use sprintf() instead</message>
</rule>
<rule ref="Squiz.WhiteSpace.CastSpacing"/>
<rule ref="Squiz.WhiteSpace.FunctionOpeningBraceSpace"/>
<rule ref="Squiz.WhiteSpace.FunctionSpacing">
<properties>
<property name="spacing" value="1"/>
</properties>
<exclude name="Squiz.WhiteSpace.FunctionSpacing.After"/><!-- does not allow PHPUnit ignore comments -->
</rule>
<rule ref="Squiz.WhiteSpace.LanguageConstructSpacing"/>
<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing"/>
<rule ref="Squiz.WhiteSpace.MemberVarSpacing"/>
<rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing">
<exclude name="Squiz.WhiteSpace.ObjectOperatorSpacing.Before"/><!-- clashes in multiline calls -->
</rule>
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
<exclude name="Squiz.WhiteSpace.OperatorSpacing.SpacingBefore"/><!-- does not work for operators on beginning of the line -->
</rule>
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
<rule ref="PSR2">
<exclude name="Generic.Files.LineLength"/><!-- can not be suppressed -->
<exclude name="PEAR.Functions.ValidDefaultValue"/><!-- we want to allow null as "default" value -->
<exclude name="PSR2.Classes.ClassDeclaration"/><!-- we want whitespace around class body and rules for extends and implements, using PEAR instead -->
<exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace"/><!-- we want to put first expression of multiline condition on next line -->
<exclude name="PSR2.ControlStructures.SwitchDeclaration.caseIndent"/><!-- checked by more generic Generic.WhiteSpace.ScopeIndent.Incorrect -->
<exclude name="PSR2.ControlStructures.SwitchDeclaration.defaultIndent"/><!-- checked by more generic Generic.WhiteSpace.ScopeIndent.Incorrect -->
<exclude name="PSR2.Methods.FunctionCallSignature.ContentAfterOpenBracket"/><!-- we want to allow comments -->
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.NewlineBeforeOpenBrace"/><!-- clashes with OpeningFunctionBraceBsdAllman -->
</rule>
</ruleset>
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
"blueimp/jquery-file-upload": "9.7.1"
},
"require-dev": {
"nette/tester": "~1.2.0"
"nette/tester": "~1.2.0",
"phing/phing": "~2.8.0",
"squizlabs/php_codesniffer": "~1.5.0"
},
"autoload": {
"psr-4": {
Expand All @@ -46,6 +48,7 @@
"VenneTests\\": "tests/src/"
}
},
"bin": ["bin/venne", "bin/venne.php"],
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
Expand Down
4 changes: 2 additions & 2 deletions src/Config/ConfigBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function offsetExists($index)
public function offsetGet($index)
{
if ($index < 0 || $index >= count($this->data)) {
throw new OutOfRangeException("Offset invalid or out of range");
throw new OutOfRangeException('Offset invalid or out of range');
}

return $this->data[$index];
Expand Down Expand Up @@ -123,7 +123,7 @@ public function offsetSet($index, $value)
public function offsetUnset($index)
{
if ($index < 0 || $index >= count($this->data)) {
throw new OutOfRangeException("Offset invalid or out of range");
throw new OutOfRangeException('Offset invalid or out of range');
}
array_splice($this->data, $index, 1);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Config/ConfigMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private function save($container = null, $rec = false, array $values = array())
if (!Strings::startsWith($key, '_')) {
if ($control instanceof \Nette\Forms\Container) {
$values[$key] = $this->save($control, true, $values);
} else if ($control instanceof \Nette\Forms\IControl) {
} elseif ($control instanceof \Nette\Forms\IControl) {
if (!$control->isOmitted()) {
$values[$key] = $control->value;
}
Expand Down
34 changes: 0 additions & 34 deletions src/Doctrine/DerivedEntityDao.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Doctrine/Entities/NamedEntityTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ trait NamedEntityTrait
/**
* @var string
*
* @ORM\Column(type="string")
* @ORM\Column(type="string", unique=true)
*/
protected $name;

Expand Down
31 changes: 15 additions & 16 deletions src/Doctrine/Mapping/DynamicMapperSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ class DynamicMapperSubscriber implements EventSubscriber
{

/** @var bool */
private $_l = false;
private $l = false;

/** @var string */
private $_lName;
private $lName;

/**
* Array of events.
Expand All @@ -46,9 +46,9 @@ public function loadClassMetadata(LoadClassMetadataEventArgs $args)
{
$meta = $args->getClassMetadata();

if ($this->_l) {
if (Strings::endsWith($meta->associationMappings[$this->_lName]['targetEntity'], '::dynamic')) {
$meta->associationMappings[$this->_lName]['targetEntity'] = $this->getTargetEntity($meta->name, $this->_l);
if ($this->l) {
if (Strings::endsWith($meta->associationMappings[$this->lName]['targetEntity'], '::dynamic')) {
$meta->associationMappings[$this->lName]['targetEntity'] = $this->getTargetEntity($meta->name, $this->l);
}

return;
Expand All @@ -63,23 +63,23 @@ public function loadClassMetadata(LoadClassMetadataEventArgs $args)
$em = $args->getEntityManager();
$target = $this->getTargetEntity($meta, $name);

$this->_l = $meta->name;
$this->_lName = $meta->associationMappings[$name]['inversedBy'];
$this->l = $meta->name;
$this->lName = $meta->associationMappings[$name]['inversedBy'];

if (!$this->_lName) {
$this->_lName = $meta->associationMappings[$name]['mappedBy'];
if (!$this->lName) {
$this->lName = $meta->associationMappings[$name]['mappedBy'];
}

if ($this->_lName) {
if ($this->lName) {
$targetMeta = $em->getClassMetadata($target);
}

$this->_l = false;
$this->l = false;

$meta->associationMappings[$name]['targetEntity'] = $target;

if ($this->_lName) {
$targetMeta->associationMappings[$this->_lName]['targetEntity'] = $meta->name;
if ($this->lName) {
$targetMeta->associationMappings[$this->lName]['targetEntity'] = $meta->name;
}

}
Expand All @@ -95,14 +95,13 @@ private function getTargetEntity(ClassMetadata $meta, $association)
$method = 'get' . ucfirst($association) . 'Name';

if (($ret = call_user_func(array($meta->name, $method))) === null) {
throw new InvalidArgumentException("Entity '{$meta->name}' must implemented method '{$method}'.");
throw new InvalidArgumentException(sprintf('Entity \'%s\' must implemented method \'%s\'.', $meta->name, $method));
}
if (!class_exists($ret)) {
throw new InvalidArgumentException("Class '{$ret}' does not exist.");
throw new InvalidArgumentException(sprintf('Class \'%s\' does not exist.', $ret));
}

return $ret;
}

}

2 changes: 0 additions & 2 deletions src/Notifications/AdminModule/DefaultPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

/**
* @author Josef Kříž <[email protected]>
*
* @secured
*/
class DefaultPresenter extends \Nette\Application\UI\Presenter
{
Expand Down
2 changes: 0 additions & 2 deletions src/Notifications/AdminModule/EmailPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

/**
* @author Josef Kříž <[email protected]>
*
* @secured
*/
class EmailPresenter extends \Nette\Application\UI\Presenter
{
Expand Down
Loading

0 comments on commit 473490a

Please sign in to comment.