@param string[] $postNames

@return Post[]
485421
public function getPostsByName(array $postNames)
    {
        $posts = [];
        foreach ($postNames as $postName) {
            if (false === $this->isPostRegistered($postName)) {
                continue;
            }
            $posts[$postName] = $this->posts[$postName];
        }

        return $posts;
    }
1122022
public function cpac_post_types( $post_types ) {

		foreach ( $post_types as $post_type => $post_type_name ) {
			if ( 0 === strpos( $post_type, '_pods_' ) || 0 === strpos( $post_type_name, '_pods_' ) ) {
				unset( $post_types[ $post_type ] );
			}
		}

		return $post_types;
	}
628317
private function prepareContent($postArray) {
		$returnArray = [];

		/**
		 * function used to concatenate two arrays key by key
		 * @param 	String		$item1		value from the first array
		 * @param 	String		$item2		value from the second array
		 * @return	String
		 */
		function combine($item1, $item2) {
			return $item1.$item2;
		}

		unset($postArray['_token']);

		foreach ($postArray as $key => $item) {
			$keys = explode('__', $key);

			if (is_array($item)) {
				if (isset($item['before'])) {
					$value = $this->sanitize(implode('|', array_map(function($item1, $item2) {return $item1.$item2;}, str_replace('|', '&#124;', $item['before']), str_replace('|', '&#124;',$item['after']))));
				} else {
					$value = $this->sanitize(implode('|', str_replace('|', '&#124;', $item['after'])));
				}
			} else {
				$value = $this->sanitize(str_replace('|', '&#124;',$item));
			}

			$this->setArrayValue($returnArray, $keys, $value);
		}

		return $returnArray;
	}
1206274
public static function getPostModules($postId)
    {

        //Declarations
        $modules = array();
        $retModules = array();

        //Get current post id
        $postId = self::pageForPostTypeTranscribe($postId);

        // Get enabled modules
        $available = \Modularity\ModuleManager::$available;
        $enabled = \Modularity\ModuleManager::$enabled;

        // Get modules structure
        $moduleIds = array();
        $moduleSidebars = null;

        if (is_numeric($postId)) {
            $moduleSidebars = get_post_meta($postId, 'modularity-modules', true);
        } else {
            $moduleSidebars = get_option('modularity_' . $postId . '_modules');
        }

        //Create array of visible modules
        if (!empty($moduleSidebars)) {
            foreach ($moduleSidebars as $sidebar) {
                foreach ($sidebar as $module) {
                    if (!isset($module['postid'])) {
                        continue;
                    }

                    $moduleIds[] = $module['postid'];
                }
            }
        }

        //Get allowed post statuses
        $postStatuses = array('publish');
        if (is_user_logged_in()) {
            $postStatuses[] = 'private';
        }

        // Get module posts
        $modulesPosts = get_posts(array(
            'posts_per_page' => -1,
            'post_type' => $enabled,
            'include' => $moduleIds,
            'post_status' => $postStatuses
        ));

        // Add module id's as keys in the array
        if (!empty($modulesPosts)) {
            foreach ($modulesPosts as $module) {
                $modules[$module->ID] = $module;
            }
        }

        // Create an strucural correct array with module post data
        if (!empty($moduleSidebars)) {
            foreach ($moduleSidebars as $key => $sidebar) {
                $retModules[$key] = array(
                    'modules' => array(),

                    // Todo: This will duplicate for every sidebar, move it to top level of array(?)
                    // Alternatively only fetch options for the current sidebar (not all like now)
                    'options' => get_post_meta($postId, 'modularity-sidebar-options', true)
                );

                $arrayIndex = 0;

                foreach ($sidebar as $moduleUid => $module) {
                    if (!isset($module['postid'])) {
                        continue;
                    }
                    $moduleId = $module['postid'];

                    if (!isset($modules[$moduleId])) {
                        continue;
                    }

                    $moduleObject = self::getModule($moduleId, $module);
                    if (!$moduleObject) {
                        continue;
                    }

                    $retModules[$key]['modules'][$arrayIndex] = $moduleObject;

                    $arrayIndex++;
                }
            }
        }

        return $retModules;
    }
678474
public function fromFullyQualifiedRelationships(array $relationshipNames)
    {
        foreach ($relationshipNames as $relationshipName) {
            $relationship = $this->getRelationshipResourceForReference($relationshipName);

            if ($relationship !== null) {
                return $relationship;
            }
        }

        return null;
    }
343187
public function ezodfGetChildren( $getParams, $getOptions, $postParams, $postOptions )
    {
        $nodeID = $getParams['nodeID'];
        $languageCode = $getOptions['languageCode'];
        $offset = $getOptions['offset'];
        $limit = $getOptions['limit'];

        $domDocument = new DOMDocument( '1.0', 'utf-8' );
        $childrenElement = $domDocument->createElement( 'Children' );

        // Set attributes.
        $childrenElement->setAttribute( 'offset', $offset );
        if ( $languageCode )
        {
            $childrenElement->setAttribute( 'languageCode', $languageCode );
        }
        $childrenElement->setAttribute( 'limit', $limit );

        // Get children, and add them to children list.
        $children = eZContentObjectTreeNode::subTreeByNodeID( array( 'Depth' => 1,
                                                                     'DepthOperator' => 'eq',
                                                                     'Limit' => $limit,
                                                                     'Offset' => $offset,
                                                                     'Language' => $languageCode ),
                                                              $nodeID );
        if ( $children )
        {
            foreach( $children as $childNode )
            {
                $childrenElement->appendChild( $this->createTreeNodeDOMElement( $domDocument, $childNode ) );
            }
            $childrenElement->setAttribute( 'count', count( $children ) );
        }
        else
        {
            $childrenElement->setAttribute( 'count', count( $children ) );
        }

        return $childrenElement;
    }
755290
public static function convertEasyPostObjectToArray($values)
    {
        $results = array();
        foreach ($values as $k => $v) {
            if ($v instanceof EasyPostObject) {
                $results[$k] = $v->__toArray(true);
            } else if (is_array($v)) {
                $results[$k] = self::convertEasyPostObjectToArray($v);
            } else {
                $results[$k] = $v;
            }
        }

        return $results;
    }
213008
public static function getFilters($filterNames = null)
    {
        if (! is_null($filterNames)) {
            if (! is_array($filterNames)) {
                $filterNames = [ $filterNames ];
            }

            return array_only(static::$filters, $filterNames);
        } else {
            return static::$filters;
        }
    }
463449
private function filterColumns(array $columnNames)
    {
        return array_filter($this->_columns, static function ($columnName) use ($columnNames) {
            return in_array($columnName, $columnNames, true);
        }, ARRAY_FILTER_USE_KEY);
    }
881233
protected function getRolesByNames(array $roleNames)
    {
        $roles = [];

        foreach ($roleNames as $roleName) {
            $role = $this->roleStorage->getRole($roleName);

            if ($role === null) {
                throw new RoleNotFound($roleName);
            }

            $roles[$roleName] = $role;

            if ($role->hasRoles()) {
                foreach ($this->getRolesByNames($role->getRoles()) as $role) {
                    $roles[$role->getName()] = $role;
                }
            }
        }

        return $roles;
    }
347794
public function findMyWorkspacesByRoleNames(array $roleNames)
    {
        $dql = '
            SELECT DISTINCT w
            FROM Claroline\CoreBundle\Entity\Workspace\Workspace w
            WHERE w IN (
                SELECT rw.id
                FROM Claroline\CoreBundle\Entity\Role r
                JOIN Claroline\CoreBundle\Entity\Workspace\Workspace rw
                WHERE r.name IN (:roleNames)
            )
            ORDER BY w.name ASC
        ';

        $query = $this->_em->createQuery($dql);
        $query->setParameter('roleNames', $roleNames);

        return $query->getResult();
    }
1093123
protected function getIndexes($indexes)
    {
        $existingNames = [];
        $finalIndexes = [];
        foreach ($indexes as $index) {
            $newIndex = Index::fromString($index);
            if (!empty($newIndex->getName()) && in_array($newIndex->getName(), $existingNames)) {
                continue;
            }

            $finalIndexes[] = $newIndex;
            $existingNames[] = $newIndex->getName();
        }

        return $finalIndexes;
    }
88334
private function transformPostValues(array $postValues): string
    {
        $body = '';
        foreach ($postValues as $key => $value) {
            $body .= urlencode($key) . '=' . urlencode($value) . '&';
        }

        return $body;
    }
642922
public function slugs(array $basenames): array
    {
        $slugs = []; // Initialize.

        foreach ($basenames as $_basename) {
            if (($_slug = $this->slug((string) $_basename))) {
                $slugs[$_basename] = $_slug;
            }
        } // unset($_basename); // Housekeeping.

        return $slugs;
    }
686522
public function indexAction($postid)
    {
        $post = $this->getPost($postid);

        $entities = $post->getComments()->toArray();
        usort($entities, function (Comment $a, Comment $b) {
            return $a->getDateCreated() < $b->getDateCreated();
        });

        return array(
            'post'     => $post,
            'entities' => $entities,
        );
    }
596533
private function getLocations($locations)
    {
        $array=[];
        foreach ($locations as $location) { /* @var \Core\Entity\LocationInterface $location */
            array_push(
                $array,
                [
                    '@type' => 'Place',
                    'address' => [
                        '@type' => 'PostalAddress',
                        'streetAddress' => $location->getStreetname() .' '.$location->getStreetnumber(),
                        'postalCode' => $location->getPostalCode(),
                        'addressLocality' => $location->getCity(),
                        'addressCountry' => $location->getCountry(),
                        'addressRegion' => $location->getRegion(),
                    ]
                ]
            );
        }
        return $array;
    }
1239393
public function getPostedPostings()
    {
        $criteria = Criteria::create()
            ->where(Criteria::expr()->neq('postedAt', null))
            ->orderBy(array('postedAt' => Criteria::ASC))
        ;

        return $this->getPostings()->matching($criteria);
    }