<commit_before><?php
/* This class is part of the XP framework
 *
 * $Id$ 
 */
  uses(
    'rdbms.criterion.CountProjection',
    'rdbms.criterion.ProjectionList',
    'rdbms.criterion.SimpleProjection'
  );

  /**
   * With the projection API a result set of an SQL query can be cut down to a
   * subset of result rows or aggregated (like sum, max, min, avg, count).
   * The projection represents the select part of a query (select <<projection>> from ...)
   * 
   * By default criteria projects the result to all rows of a table. This can be changed by
   * using the <tt>rdbms.Criteria::setProjection()</tt> method.
   *
   * Example
   * =======
   * <code>
   *   // cut the result down to 2 atributes of a result set
   *   // for further examples with ProjectionList see rdbms.criterion.ProjectionList API doc
   *   // sql: select name, surname from person;
   *   Person::getPeer()->doSelect(create(new Criteria())->setProjection(
   *     Projections::projectionList()
   *     ->add(Projections::property(Person::column('name')))
   *     ->add(Projections::property(Person::column('surname')))
   *   ));
   *   
   *   // just count a result
   *   // for further examples with ProjectionList see rdbms.criterion.CountProjection API doc
   *   // sql: select count(*) from person where ...
   *   Person::getPeer()->doSelect(create(new Criteria())->setProjection(Projections::count('*'))->add(...)...);
   *   
   *   // aggregated result set
   *   // sql: select avg(age) from person
   *   // sql: select min(age) from person
   *   // sql: select max(age) from person
   *   Person::getPeer()->doSelect(create(new Criteria())->setProjection(Projections::avg(Person::column('age'))));
   *   Person::getPeer()->doSelect(create(new Criteria())->setProjection(Projections::min(Person::column('age'))));
   *   Person::getPeer()->doSelect(create(new Criteria())->setProjection(Projections::max(Person::column('age'))));
   *   
   *   // ProjectionList::add and Criteria::setprojection, can handle a second parameter as an ailias
   *   // sql: select max(age) as `oldest` from person
   *   Person::getPeer()->doSelect(create(new Criteria())->setProjection(Projections::max(Person::column('age')), 'oldest'));
   * </code>
   *
   * @test     xp://net.xp_framework.unittest.rdbms.ProjectionTest
   * @see      xp://rdbms.Criteria
   * @see      xp://rdbms.criterion.ProjectionList
   * @see      xp://rdbms.criterion.CountProjection
   * @purpose  Projection factory
   */
  class Projections extends Object {

    /**
     * manufactor a new ProjectionList
     *
     * @param   array<rdbms.SQLRenderable> properties
     * @return  rdbms.criterion.ProjectionList
     */
    public static function projectionList($properties= array()) {<commit_msg>- QA: Reformat example #2 - < 72 chars<commit_after><?php
/* This class is part of the XP framework
 *
 * $Id$ 
 */
  uses(
    'rdbms.criterion.CountProjection',
    'rdbms.criterion.ProjectionList',
    'rdbms.criterion.SimpleProjection'
  );

  /**
   * With the projection API a result set of an SQL query can be cut down to a
   * subset of result rows or aggregated (like sum, max, min, avg, count).
   * The projection represents the select part of a query (select <<projection>> from ...)
   * 
   * By default criteria projects the result to all rows of a table. This can be changed by
   * using the <tt>rdbms.Criteria::setProjection()</tt> method.
   *
   * Example
   * =======
   * <code>
   *   // cut the result down to 2 atributes of a result set
   *   // for further examples with ProjectionList see rdbms.criterion.ProjectionList API doc
   *   // sql: select name, surname from person;
   *   Person::getPeer()->doSelect(new Criteria()->setProjection(
   *     Projections::projectionList()
   *     ->add(Projections::property(Person::column('name')))
   *     ->add(Projections::property(Person::column('surname')))
   *   ));
   *   
   *   // just count a result
   *   // for further examples with ProjectionList see rdbms.criterion.CountProjection API doc
   *   // sql: select count(*) from person where ...
   *   Person::getPeer()->doSelect(new Criteria()->setProjection(
   *     Projections::count('*')->add(...)...
   *   ));
   *   
   *   // aggregated result set
   *   // sql: select avg(age) from person
   *   // sql: select min(age) from person
   *   // sql: select max(age) from person
   *   Person::getPeer()->doSelect(new Criteria()->setProjection(
   *     Projections::avg(Person::column('age'))
   *   ));
   *   Person::getPeer()->doSelect(new Criteria()->setProjection(
   *     Projections::min(Person::column('age')))
   *   );
   *   Person::getPeer()->doSelect(new Criteria()->setProjection(
   *     Projections::max(Person::column('age'))
   *   ));
   *   
   *   // ProjectionList::add and Criteria::setprojection, can handle a second parameter as an ailias
   *   // sql: select max(age) as `oldest` from person
   *   Person::getPeer()->doSelect(new Criteria()->setProjection(
   *     Projections::max(Person::column('age')), 
   *     'oldest'
   *   ));
   * </code>
   *
   * @test     xp://net.xp_framework.unittest.rdbms.ProjectionTest
   * @see      xp://rdbms.Criteria
   * @see      xp://rdbms.criterion.ProjectionList
   * @see      xp://rdbms.criterion.CountProjection
   * @purpose  Projection factory
   */
  class Projections extends Object {

    /**
     * manufactor a new ProjectionList
     *
     * @param   array<rdbms.SQLRenderable> properties
     * @return  rdbms.criterion.ProjectionList
     */
    public static function projectionList($properties= array()) {
{'fraction_non_alphanumeric': 0.14965259219668625, 'fraction_numerical': 0.0008907892392659896, 'mean_word_length': 3.0622286541244574, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '926051', 'n_tokens_mistral': 1758, 'n_tokens_neox': 1718, 'n_words': 421}